How to test SCons modifications

My team is building a SCons based build system. We created a bunch of helper classes in our own site_scons / site_tools folder.

My task is to create and run tests of our code using pyunit. Probably, the test code will be in a subfolder, and the catalog layout looks something like this:

SConstruct
our_source_code/
   Sconscript
site_scons/
    site_tools/
        a.py
        b.py
        c.py
        tests/
            test_a.py
            test_b.py
            test_c.py

Now my question is: what is the best way to invoke our tests, given that they are likely to require setting up the correct SCons environment? (i.e. a.py uses SCons.Environment)

Am I adding a builder or team? Or something else?

+3
source share
1 answer

, SCons. SVN- SCons, tarball SCons. , , .

, javac. , SConstruct, , . Python, , , . :

import TestSCons
test = TestSCons.TestSCons()
test.write('SConstruct', '''env = Environment(tools = ["yourtool"])
env.RunYourTool()''')

test.write('sourcefile.x', 'Content goes here')
test.run(arguments = '.', stderr = None)

test.must_match('outputfile', 'desired contents')
test.pass_test()

SCons swtoolkit wiki, , -, SCons Google. wiki - , , SCons.

+2

Source: https://habr.com/ru/post/1752113/


All Articles