diff --git a/src/python/SConscript b/src/python/SConscript index c89bc28f3..9fed74442 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -61,6 +61,7 @@ if localenv['python_package'] == 'full': dest = pjoin('interfaces', 'python', 'Cantera', file.name) localenv.AddPreAction(pymodule,Copy(dest, file)) + env['python_module'] = pymodule elif localenv['python_package'] == 'minimal': pymodule = make_setup diff --git a/test/SConscript b/test/SConscript index f39b5400e..d81d4bcf7 100644 --- a/test/SConscript +++ b/test/SConscript @@ -62,7 +62,9 @@ def addTestScript(subdir, script, interpreter, dependencies): passedFile = File(pjoin(subdir, '%s.passed' % (script))) run_program = testenv.Command(passedFile, pjoin(subdir, script), scriptRunner) for dep in dependencies: - testenv.Depends(run_program, File(pjoin(subdir, dep))) + if isinstance(dep, str): + dep = File(pjoin(subdir, dep)) + testenv.Depends(run_program, dep) Alias('newtest', run_program) if os.path.exists(passedFile.abspath): Alias('newtest-reset', testenv.Command('reset-%s%s' % (subdir, script), @@ -72,4 +74,4 @@ def addTestScript(subdir, script, interpreter, dependencies): addTestProgram('thermo', 'nasapoly') addTestScript('python', 'runTests.py', interpreter=sys.executable, - dependencies=['testSolution.py']) + dependencies=['testSolution.py', localenv['python_module']]) diff --git a/test_problems/SConscript b/test_problems/SConscript index d54d0effc..0e722db75 100644 --- a/test_problems/SConscript +++ b/test_problems/SConscript @@ -10,10 +10,12 @@ os.environ['CANTERA_DATA'] = pjoin(os.getcwd(), '..', 'data', 'inputs') testNames = [] class Test(object): + _validArgs = set(['arguments', 'options', 'artifacts', 'comparisons', + 'tolerance', 'threshold', 'ignoreLines', 'extensions', + 'dependencies']) + def __init__(self, testName, subdir, programName, blessedName, **kwargs): - assert set(kwargs.keys()) <= set(['arguments', 'options', 'artifacts', - 'comparisons', 'tolerance', 'threshold', - 'ignoreLines', 'extensions']), kwargs.keys() + assert set(kwargs.keys()) <= self._validArgs, kwargs.keys() self.subdir = subdir self.programName = programName arguments = kwargs.get('arguments') or [] @@ -45,6 +47,9 @@ class Test(object): # reset: just delete the ".passed" file so that this test will be re-run localenv.Alias('test-reset', self.reset(localenv)) + for dep in kwargs.get('dependencies', []): + localenv.Depends(run, dep) + def run(self, env, *args): source = list(args) if not source: @@ -299,20 +304,23 @@ CompileAndTest('VPsilane_test', 'VPsilane_test', 'VPsilane_test', 'output_blesse # Python Tests if localenv['python_package'] == 'full': + testDeps = [localenv['python_module']] Test('python-diamond', 'python', '$python_cmd', None, options='../../samples/python/surface_chemistry/diamond_cvd/diamond.py', comparisons=[('diamond_blessed.csv', 'diamond.csv')], - artifacts=['diamond.xml']) + artifacts=['diamond.xml'], dependencies=testDeps) Test('python-frac', 'python', '$python_cmd', 'frac_blessed.out', - arguments='frac.py', artifacts=['frac.xml']) + arguments='frac.py', artifacts=['frac.xml'], dependencies=testDeps) Test('python-tut1', pjoin('python','tut1'), '$python_cmd', - 'output_blessed.txt', arguments='tut1.py', artifacts=['gri30.xml']) + 'output_blessed.txt', arguments='tut1.py', artifacts=['gri30.xml'], + dependencies=testDeps) Test('python-tut2', pjoin('python','tut2'), '$python_cmd', 'output_blessed.txt', arguments='tut2.py', - artifacts=['gri30.xml', 'diamond.xml']) + dependencies=testDeps, artifacts=['gri30.xml', 'diamond.xml']) # Skipping Python Tutorial 3 (documentation only) Test('python-tut4', pjoin('python','tut4'), '$python_cmd', - 'output_blessed.txt', arguments='tut4.py', artifacts=['gri30.xml']) + 'output_blessed.txt', arguments='tut4.py', artifacts=['gri30.xml'], + dependencies=testDeps) finish_tests = localenv.Command('finish_tests', [], testResults.printReport) localenv.Depends(finish_tests, 'test-run')