updated run tests script to do work with test basic

This commit is contained in:
Bryan Herman 2013-08-21 16:19:54 -04:00
parent 8753d7b8b1
commit f54b5fa2c7
3 changed files with 38 additions and 14 deletions

View file

@ -4,6 +4,7 @@ import os
from subprocess import Popen, STDOUT, PIPE
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -12,7 +13,6 @@ def setup():
os.chdir(pwd)
def test_run():
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
@ -24,17 +24,21 @@ def test_run():
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob('statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob('statepoint.10.*')
os.system('python results.py {0}'.format(statepoint[0]))
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
statepoint = glob.glob('statepoint.10.*')
output = [pwd + '/{0}'.format(statepoint[0]), pwd + '/results_test.dat']
for f in output:
if os.path.exists(f):
os.remove(f)