1 |
|
2 |
######################################################## |
3 |
# |
4 |
# Copyright (c) 2003-2012 by University of Queensland |
5 |
# Earth Systems Science Computational Center (ESSCC) |
6 |
# http://www.uq.edu.au/esscc |
7 |
# |
8 |
# Primary Business: Queensland, Australia |
9 |
# Licensed under the Open Software License version 3.0 |
10 |
# http://www.opensource.org/licenses/osl-3.0.php |
11 |
# |
12 |
######################################################## |
13 |
|
14 |
from os.path import splitext |
15 |
Import('*') |
16 |
|
17 |
local_env = env.Clone() |
18 |
|
19 |
# files defining test runs (passing in a release) |
20 |
testruns = ['run_gravity.py'] |
21 |
|
22 |
# files defining tests run locally (not as part of a release) |
23 |
localtestruns = [x for x in Glob('*.py', strings=True) if not x.startswith('run_')] |
24 |
|
25 |
# all tests |
26 |
alltestruns = testruns + localtestruns |
27 |
|
28 |
# test files are just compiled - none of those in downunder yet |
29 |
#sources = Glob('test_*.py') |
30 |
#test_pyc = env.PyCompile(sources) |
31 |
#env.Alias('build_py_tests', test_pyc) |
32 |
|
33 |
# add unit test to target alias |
34 |
local_env.PrependENVPath('PYTHONPATH', env.Dir('$BUILD_DIR/$PLATFORM/escript/test/python').abspath) |
35 |
local_env.PrependENVPath('PYTHONPATH', Dir('.').abspath) |
36 |
local_env['ENV']['DOWNUNDER_TEST_DATA_ROOT']=Dir('.').srcnode().abspath |
37 |
local_env['ENV']['DOWNUNDER_WORKDIR']=Dir('.').abspath |
38 |
env.Alias('local_py_tests',[splitext(x)[0]+'.passed' for x in alltestruns]) |
39 |
env.Alias('py_tests', [splitext(x)[0]+'.passed' for x in testruns]) |
40 |
|
41 |
# run all tests |
42 |
program = local_env.RunPyUnitTest(alltestruns) |
43 |
Depends(program, 'build_py_tests') |
44 |
|
45 |
# add a group of tests |
46 |
from grouptest import * |
47 |
tgroup=GroupTest("$PYTHONRUNNER ",(("DOWNUNDER_TEST_DATA_ROOT","$BATCH_ROOT/downunder/test/python"),('DOWNUNDER_WORKDIR','$BUILD_DIR/downunder/test/python')),"$BUILD_DIR/escript/test/python:$BUILD_DIR/downunder/test/python","$BATCH_ROOT/downunder/test/python",testruns) |
48 |
tgroup.makeDir("$BUILD_DIR/downunder/test") |
49 |
tgroup.makeDir("$BUILD_DIR/downunder/test/python") |
50 |
TestGroups.append(tgroup) |
51 |
|