EGS Brachy
An egs++ user code for rapid brachytherapy calculations
Loading...
Searching...
No Matches
gen_tests.py
Go to the documentation of this file.
1import glob
2import importlib
3import os
4import sys
5
6root_tests = os.path.join("..", "eb_tests")
7sys.path.append("..")
8
9globber = os.path.join(root_tests, "*", "test.py")
10
12 items = []
13
14
15 for f in sorted(glob.glob(globber)):
16
17 test_name = os.path.split(os.path.dirname(f))[1]
18 mod_path = "eb_tests.%s.test" % test_name
19 test_mod = importlib.import_module(mod_path)
20 docstring = test_mod.__doc__
21 test_dir = "eb_tests/%s" % test_name
22 title = test_name.replace("_", " ").title()
23 description = """## %s\n**Test Directory:** %s\n\n%s\n""" % (title, test_dir, docstring)
24
25 items.append(description)
26
27 return "\n".join(items)
28
29
30def gen_docs(fname):
31
32 docs = """@anchor egs_brachy_test_suite
33
34egs_brachy Test Suite
35=====================
36
37The current list of tests available in the egs_brachy test suite
38
39%s
40
41""" % (get_tests())
42
43
44 open(fname, "w").write(docs)
45
46if __name__ == "__main__":
47 outfile = "tests.md"
48 gen_docs(outfile)
49
string join(const vector< string > &v, string delim)
Definition ginfo.cpp:56