Skip to content

Commit 09c0140

Browse files
Add g04 and exampleB3b to the tests
1 parent 3789bf8 commit 09c0140

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/test_examples.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
def test_example(dir, py_file, macro_file, out_file, extra_params=[]):
77
examples_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../examples')
88

9-
py_file = os.path.join(os.path.join(examples_dir, dir), py_file)
10-
macro_file = os.path.join(os.path.join(examples_dir, dir), macro_file)
11-
out_file = os.path.join(os.path.join(examples_dir, dir), out_file)
12-
139
params = [sys.executable, py_file]
1410
params += extra_params
1511
params += [macro_file]
16-
output = subprocess.check_output(params)
12+
output = subprocess.check_output(params, cwd=os.path.join(examples_dir, dir))
1713

18-
with open(out_file, 'r') as file:
19-
if output.decode('utf-8').find(file.read()) == -1:
20-
raise Exception(output.decode('utf-8'))
14+
if out_file != False:
15+
out_file = os.path.join(os.path.join(examples_dir, dir), out_file)
16+
with open(out_file, 'r') as file:
17+
if output.decode('utf-8').find(file.read()) == -1:
18+
raise Exception(output.decode('utf-8'))
2119

2220

2321
os.environ['G4FORCE_RUN_MANAGER_TYPE'] = 'Serial'
@@ -28,11 +26,13 @@ def test_example(dir, py_file, macro_file, out_file, extra_params=[]):
2826
test_example('B2', 'exampleB2b.py', 'exampleB2.in', 'exampleB2b.out')
2927

3028
test_example('B3', 'exampleB3a.py', 'exampleB3.in', 'exampleB3a.out')
31-
#test_example('B3', 'exampleB3b.py', 'exampleB3.in', 'exampleB3b.out')
29+
test_example('B3', 'exampleB3b.py', 'exampleB3.in', False)
3230

3331
test_example('B4', 'exampleB4a.py', 'exampleB4.in', 'exampleB4a.out', ['-m'])
3432
test_example('B4', 'exampleB4b.py', 'exampleB4.in', 'exampleB4b.out', ['-m'])
3533
test_example('B4', 'exampleB4c.py', 'exampleB4.in', 'exampleB4c.out', ['-m'])
3634
test_example('B4', 'exampleB4d.py', 'exampleB4.in', 'exampleB4d.out', ['-m'])
3735

3836
test_example('B5', 'exampleB5.py', 'exampleB5.in', 'exampleB5.out')
37+
38+
test_example('gdml', 'g04.py', 'g04.mac', False, ['auxiliary.gdml'])

0 commit comments

Comments
 (0)