# __COPYRIGHT____revision__="__FILE__ __REVISION__ __DATE__ __DEVELOPER__"__doc__="""TestSConsign.py: a testing framework for the "sconsign" script tool.A TestSConsign environment object is created via the usual invocation: test = TestSConsign()TestSconsign is a subclass of TestSCons, which is a subclass ofTestCommon, which is in turn is a subclass of TestCmd), and hencehas available all of the methods and attributes from those classes,as well as any overridden or additional methods or attributes definedin this subclass."""importosimportos.pathimportstringimportsysfromTestSConsimport*fromTestSConsimport__all____all__.extend(['TestSConsign',])classTestSConsign(TestSCons):"""Class for testing the sconsign.py script. This provides a common place for initializing sconsign tests, eliminating the need to begin every test with the same repeated initializations. This adds additional methods for running the sconsign script without changing the basic ability of the run() method to run "scons" itself, since we need to run scons to generate the .sconsign files that we want the sconsign script to read. """def__init__(self,*args,**kw):try:script_dir=os.environ['SCONS_SCRIPT_DIR']exceptKeyError:passelse:os.chdir(script_dir)self.script_dir=os.getcwd()apply(TestSCons.__init__,(self,)+args,kw)self.my_kw={'interpreter':python,# imported from TestSCons}ifos.path.exists(self.script_path('sconsign.py')):sconsign='sconsign.py'elifos.path.exists(self.script_path('sconsign')):sconsign='sconsign'else:print"Can find neither 'sconsign.py' nor 'sconsign' scripts."self.no_result()self.set_sconsign(sconsign)defscript_path(self,script):returnos.path.join(self.script_dir,script)defset_sconsign(self,sconsign):self.my_kw['program']=sconsigndefrun_sconsign(self,*args,**kw):kw.update(self.my_kw)returnapply(self.run,args,kw)