1 |
Import('*') |
Import('*') |
|
|
|
2 |
local_env=env.Copy() |
local_env=env.Copy() |
|
|
|
3 |
src_dir = local_env.Dir('.').srcnode().abspath |
src_dir = local_env.Dir('.').srcnode().abspath |
|
|
|
4 |
import os |
import os |
5 |
filenames = os.listdir(src_dir) |
filenames = os.listdir(src_dir) |
6 |
python_src = [x for x in filenames if os.path.splitext(x)[1] in ['.py']] |
# |
7 |
|
# files defining tests but are not running by itself: |
8 |
# Filter out busted or not frequently run tests |
# |
9 |
|
testfiles = [x for x in filenames if x.startswith('test_') and os.path.splitext(x)[1] in ['.py'] ] |
10 |
program = local_env.RunPyUnitTest(python_src) |
# |
11 |
|
# directories defining test data |
12 |
|
# |
13 |
|
testdata_dir = [x for x in filenames if x.startswith('data_') ] |
14 |
|
# |
15 |
|
# files defining test runs (passing in a release) |
16 |
|
# |
17 |
|
testruns = [x for x in filenames if x.startswith('run_') and os.path.splitext(x)[1] in ['.py'] ] |
18 |
|
# |
19 |
|
# files defining tests run locally (not as part of a release) |
20 |
|
# |
21 |
|
localtestruns = [x for x in filenames if not x.startswith('run_') and os.path.splitext(x)[1] in ['.py']] |
22 |
|
# |
23 |
|
# all test |
24 |
|
# |
25 |
|
alltestruns = testruns + localtestruns |
26 |
|
# |
27 |
|
# test files are just compiled: |
28 |
|
# |
29 |
|
test_pyc = local_env.PyCompile(testfiles) |
30 |
|
# |
31 |
|
# run all tests: |
32 |
|
# |
33 |
|
program = local_env.RunPyUnitTest(alltestruns) |
34 |
|
|
35 |
|
Depends(pyinstall, test_pyc) |
36 |
Depends(program, pyinstall) |
Depends(program, pyinstall) |
37 |
Depends(program, libinstall) # FIXME: The python tests require objects from finley hence you have to have all the libraries available rather than just dep_lib |
Depends(program, dep_lib) |
38 |
|
|
39 |
#Add Unit Test to target alias |
#Add Unit Test to target alias |
40 |
test_targets = [os.path.splitext(x)[0]+'.passed' for x in python_src] |
env.Alias('local_py_tests',[os.path.splitext(x)[0]+'.passed' for x in alltestruns]) |
41 |
|
env.Alias('py_tests', [os.path.splitext(x)[0]+'.passed' for x in testruns ]) |
42 |
|
|
43 |
|
# get all the python files in the release tar file |
44 |
|
release_pyfiles = [ env.File("SConscript"), ] |
45 |
|
print env.Dir(testdata_dir[0],'.') |
46 |
|
release_testfiles = [ env.File(x) for x in testfiles + testruns ] + [ env.Dir(x,'.') for x in testdata_dir ] |
47 |
|
env.Zip(src_zipfile, release_pyfiles) |
48 |
|
env.Tar(src_tarfile, release_pyfiles) |
49 |
|
env.Zip(test_zipfile, release_testfiles) |
50 |
|
env.Tar(test_tarfile, release_testfiles) |
51 |
|
|
|
env.Alias('py_tests',test_targets) |
|
|
env.Alias('basic_py_tests',['ImportTest.passed', 'finleyTest.passed', 'SimpleSolve.passed', 'RecTest.passed', 'test_linearPDEsOnFinley.passed', 'test_generators.passed', 'test_visualization_interface.passed', 'test_utilOnFinley.passed']) |
|