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