2013-02-01 15:22:32 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
from subprocess import Popen, STDOUT, PIPE
|
2013-08-22 12:17:28 -04:00
|
|
|
from nose_mpi import NoseMPI
|
2013-02-01 15:22:32 -05:00
|
|
|
|
|
|
|
|
pwd = os.path.dirname(__file__)
|
|
|
|
|
|
|
|
|
|
def setup():
|
|
|
|
|
os.putenv('PWD', pwd)
|
|
|
|
|
os.chdir(pwd)
|
|
|
|
|
|
|
|
|
|
def test_run():
|
2013-08-22 12:17:28 -04:00
|
|
|
openmc_path = pwd + '/../../src/openmc'
|
|
|
|
|
if int(NoseMPI.mpi_np) > 0:
|
|
|
|
|
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, '-p'],
|
|
|
|
|
stderr=STDOUT, stdout=PIPE)
|
|
|
|
|
else:
|
|
|
|
|
proc = Popen([openmc_path, '-p'], stderr=STDOUT, stdout=PIPE)
|
2013-02-01 15:22:32 -05:00
|
|
|
print(proc.communicate()[0])
|
2013-10-16 23:03:40 -04:00
|
|
|
returncode = proc.returncode
|
2013-02-01 15:22:32 -05:00
|
|
|
assert returncode == 0
|
|
|
|
|
|
|
|
|
|
def test_plots_exists():
|
|
|
|
|
assert os.path.exists(pwd + '/1_plot.ppm')
|
|
|
|
|
assert os.path.exists(pwd + '/2_plot.ppm')
|
|
|
|
|
assert os.path.exists(pwd + '/3_plot.ppm')
|
|
|
|
|
|
|
|
|
|
def teardown():
|
|
|
|
|
output = [pwd + '/1_plot.ppm', pwd + '/2_plot.ppm', pwd + '/3_plot.ppm']
|
|
|
|
|
for f in output:
|
|
|
|
|
if os.path.exists(f):
|
|
|
|
|
os.remove(f)
|