SCons / QMTest /

Full commit
Steven Knight d919bd6 

Greg Noel 450d604 
Steven Knight d919bd6 

Greg Noel 450d604 
Steven Knight de95880 

Steven Knight d919bd6 

Greg Noel 450d604 
Steven Knight 9aa3f9a 


__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

__doc__ = """  a testing framework for the "sconsign" script 

A TestSConsign environment object is created via the usual invocation:

    test = TestSConsign()

TestSconsign is a subclass of TestSCons, which is a subclass of
TestCommon, which is in turn is a subclass of TestCmd), and hence
has available all of the methods and attributes from those classes,
as well as any overridden or additional methods or attributes defined
in this subclass.

import os
import os.path
import sys

from TestSCons import *
from TestSCons import __all__

__all__.extend([ 'TestSConsign', ])

class TestSConsign(TestSCons):
    """Class for testing the script.

    This provides a common place for initializing sconsign tests,
    eliminating the need to begin every test with the same repeated

    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):
            script_dir = os.environ['SCONS_SCRIPT_DIR']
        except KeyError:
        self.script_dir = os.getcwd()

        TestSCons.__init__(self, *args, **kw)

        self.my_kw = {
            'interpreter' : python,     # imported from TestSCons

        if 'program' not in kw:
            kw['program'] = os.environ.get('SCONS')
            if not kw['program']:
                if os.path.exists('scons'):
                    kw['program'] = 'scons'
                    kw['program'] = ''

        sconsign = os.environ.get('SCONSIGN')
        if not sconsign:
            if os.path.exists(self.script_path('')):
                sconsign = ''
            elif os.path.exists(self.script_path('sconsign')):
                sconsign = 'sconsign'
                print "Can find neither '' nor 'sconsign' scripts."

    def script_path(self, script):
        return os.path.join(self.script_dir, script)

    def set_sconsign(self, sconsign):
        self.my_kw['program'] = sconsign

    def run_sconsign(self, *args, **kw):
        return*args, **kw)

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4: