3 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
6 TestSConsign.py: a testing framework for the "sconsign" script
9 A TestSConsign environment object is created via the usual invocation:
13 TestSconsign is a subclass of TestSCons, which is a subclass of
14 TestCommon, which is in turn is a subclass of TestCmd), and hence
15 has available all of the methods and attributes from those classes,
16 as well as any overridden or additional methods or attributes defined
24 from TestSCons import *
25 from TestSCons import __all__
27 __all__.extend([ 'TestSConsign', ])
29 class TestSConsign(TestSCons):
30 """Class for testing the sconsign.py script.
32 This provides a common place for initializing sconsign tests,
33 eliminating the need to begin every test with the same repeated
36 This adds additional methods for running the sconsign script
37 without changing the basic ability of the run() method to run
38 "scons" itself, since we need to run scons to generate the
39 .sconsign files that we want the sconsign script to read.
41 def __init__(self, *args, **kw):
43 script_dir = os.environ['SCONS_SCRIPT_DIR']
48 self.script_dir = os.getcwd()
50 TestSCons.__init__(self, *args, **kw)
53 'interpreter' : python, # imported from TestSCons
56 if 'program' not in kw:
57 kw['program'] = os.environ.get('SCONS')
59 if os.path.exists('scons'):
60 kw['program'] = 'scons'
62 kw['program'] = 'scons.py'
64 sconsign = os.environ.get('SCONSIGN')
66 if os.path.exists(self.script_path('sconsign.py')):
67 sconsign = 'sconsign.py'
68 elif os.path.exists(self.script_path('sconsign')):
71 print "Can find neither 'sconsign.py' nor 'sconsign' scripts."
73 self.set_sconsign(sconsign)
75 def script_path(self, script):
76 return os.path.join(self.script_dir, script)
78 def set_sconsign(self, sconsign):
79 self.my_kw['program'] = sconsign
81 def run_sconsign(self, *args, **kw):
83 return self.run(*args, **kw)
87 # indent-tabs-mode:nil
89 # vim: set expandtab tabstop=4 shiftwidth=4: