-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.py
executable file
·72 lines (54 loc) · 1.87 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
""" Runs opendeplete's test suite.
There are two test suites:
1. The "normal" test suite contains all tests that take less than a second.
This excludes OpenMC tests. This is default.
2. The "full" test suite contains all in the "normal" suite, as well as
A few tests of the OpenMC functionality as well. Passing this test
basically guarantees everything works fully coupled together, but
it can take a few minutes.
The test suite is passed as the first argument.
"""
import unittest
import argparse
# Tests. Add them as they're produced.
SUITE_NORMAL = [
"test.test_atom_number",
"test.test_cecm_regression",
"test.test_cram",
"test.test_depletion_chain",
"test.test_integrator",
"test.test_nuclide",
"test.test_predictor_regression",
"test.test_reaction_rates",
"test.test_utilities"
]
SUITE_FULL = [
"test.test_full"
]
def test(use_full):
""" Run all tests in suite.
Parameters
----------
use_full : bool
Whether or not to do tests listed in SUITE_FULL.
"""
test_suite = unittest.TestSuite()
for module_test in SUITE_NORMAL:
tests = unittest.defaultTestLoader.loadTestsFromName(module_test)
test_suite.addTest(tests)
if use_full:
for module_test in SUITE_FULL:
tests = unittest.defaultTestLoader.loadTestsFromName(module_test)
test_suite.addTest(tests)
unittest.TextTestRunner().run(test_suite)
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Runs opendeplete's test suite.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument("--suite", type=str, default="normal",
help='Which suite to run, "normal" or "full"')
args = parser.parse_args()
full_test = (args.suite == "full")
test(full_test)