/[escript]/trunk/modellib/test/python/SConscript
ViewVC logotype

Diff of /trunk/modellib/test/python/SConscript

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3258 by jfenwick, Thu Jan 28 02:03:15 2010 UTC revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC
# Line 11  Line 11 
11  #  #
12  ########################################################  ########################################################
13    
14    from os.path import splitext
 import os  
15  Import('*')  Import('*')
16    
17  local_env = clone_env(env)  local_env = env.Clone()
18    
19  src_dir = local_env.Dir('.').srcnode().abspath  # files defining test runs (passing in a release)
20  filenames = os.listdir(src_dir)  testruns = ['run_convection.py']
 #  
 # files defining tests but are not running by itself:  
 #  
 testfiles = [x for x in filenames if x.startswith('test_') and os.path.splitext(x)[1] in ['.py'] ]  
 #  
 # directories defining test data  
 #  
 testdata_dir = [x for x in filenames if x.startswith('data_') ]  
 #  
 #  files defining test runs (passing in a release)  
 #  
 testruns = []  
 testruns += ['run_convection.py']  
21  testruns += ['run_flow.py']  testruns += ['run_flow.py']
22  testruns += ['run_temp.py']  testruns += ['run_temp.py']
 #  
 # files defining tests run locally (not as part of a release)  
 #  
 localtestruns = [x for x in filenames if not x.startswith('run_') and os.path.splitext(x)[1] in ['.py']]  
 #  
 # all test  
 #  
 alltestruns = testruns + localtestruns  
 #  
 # test files are just compiled:  
 #  
 test_pyc = env.PyCompile(testfiles)  
 env.Alias('build_py_tests',test_pyc)  
 #  
 # run all tests:  
 #  
 program = local_env.RunPyUnitTest(alltestruns)  
23    
24  # Add a group of tests  # files defining tests run locally (not as part of a release)
25  from grouptest import *    localtestruns = [x for x in Glob('*.py', strings=True) if not x.startswith('run_')]
 tgroup=GroupTest("$PYTHONRUNNER ",(("MODELLIB_TEST_DATA_ROOT","$BATCH_ROOT/modellib/test/python"),('MODELLIB_WORKDIR','$BUILD_DIR/modellib/test/python')),"$BUILD_DIR/escript/test/python:$BUILD_DIR/modellib/test/python","$BATCH_ROOT/modellib/test/python",testruns)  
 tgroup.makeDir("$BUILD_DIR/modellib/test")  
 tgroup.makeDir("$BUILD_DIR/modellib/test/python")  
 TestGroups.append(tgroup)  
26    
27    # all tests
28    alltestruns = testruns + localtestruns
29    
30  Depends(program, local_env['pyinstall'])  # test files are just compiled - none of those in modellib yet
31  Depends(program, dep_lib)  #sources = Glob('test_*.py')
32  Depends(program, 'build_py_tests')  #test_pyc = env.PyCompile(sources)
33    #env.Alias('build_py_tests', test_pyc)
34    
35  #Add Unit Test to target alias  # add unit test to target alias
36  local_env.PrependENVPath('PYTHONPATH',str(env.Dir('#/build/$PLATFORM/escript/test/python')))  local_env.PrependENVPath('PYTHONPATH',str(env.Dir('#/build/$PLATFORM/escript/test/python')))
37  local_env.PrependENVPath('PYTHONPATH',str(env.Dir('#/build/$PLATFORM/modellib/test/python')))  local_env.PrependENVPath('PYTHONPATH',str(env.Dir('#/build/$PLATFORM/modellib/test/python')))
38  local_env['ENV']['MODELLIB_TEST_DATA_ROOT']=env.Dir('#/modellib/test/python').srcnode().abspath  local_env['ENV']['MODELLIB_TEST_DATA_ROOT']=env.Dir('#/modellib/test/python').srcnode().abspath
39  local_env['ENV']['MODELLIB_WORKDIR']=env.Dir('#/build/$PLATFORM/modellib/test/python').srcnode().abspath  local_env['ENV']['MODELLIB_WORKDIR']=env.Dir('#/build/$PLATFORM/modellib/test/python').srcnode().abspath
40  env.Alias('local_py_tests',[os.path.splitext(x)[0]+'.passed' for x in alltestruns])  env.Alias('local_py_tests',[splitext(x)[0]+'.passed' for x in alltestruns])
41  env.Alias('py_tests', [os.path.splitext(x)[0]+'.passed' for x in testruns ])  env.Alias('py_tests', [splitext(x)[0]+'.passed' for x in testruns])
42    
43    # run all tests
44    program = local_env.RunPyUnitTest(alltestruns)
45    Depends(program, 'build_py_tests')
46    
47    # add a group of tests
48    from grouptest import *
49    tgroup=GroupTest("$PYTHONRUNNER ",(("MODELLIB_TEST_DATA_ROOT","$BATCH_ROOT/modellib/test/python"),('MODELLIB_WORKDIR','$BUILD_DIR/modellib/test/python')),"$BUILD_DIR/escript/test/python:$BUILD_DIR/modellib/test/python","$BATCH_ROOT/modellib/test/python",testruns)
50    tgroup.makeDir("$BUILD_DIR/modellib/test")
51    tgroup.makeDir("$BUILD_DIR/modellib/test/python")
52    TestGroups.append(tgroup)
53    

Legend:
Removed from v.3258  
changed lines
  Added in v.3259

  ViewVC Help
Powered by ViewVC 1.1.26