using os.path.join to join paths instead of string concatenation

This commit is contained in:
Bryan Herman 2014-04-08 18:19:44 -04:00
parent 3ad1bd2f20
commit 92dce0b83b
75 changed files with 390 additions and 390 deletions

View file

@ -24,16 +24,16 @@ def test_run():
assert returncode == 0, 'OpenMC did not exit successfully.'
def test_created_statepoint():
statepoint = glob.glob(cwd + '/statepoint.10.*')
statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*'))
assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.'
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
'Statepoint file is not a binary or hdf5 file.'
def test_output_exists():
assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.'
assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.'
def test_results():
statepoint = glob.glob(cwd + '/statepoint.10.*')
statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*'))
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
@ -41,9 +41,9 @@ def test_results():
assert compare, 'Results do not agree.'
def teardown():
output = glob.glob(cwd + '/statepoint.10.*')
output.append(cwd + '/tallies.out')
output.append(cwd + '/results_test.dat')
output = glob.glob(os.path.join(cwd,'statepoint.10.*'))
output.append(os.path.join(cwd,'tallies.out'))
output.append(os.path.join(cwd,'results_test.dat'))
for f in output:
if os.path.exists(f):
os.remove(f)