mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Don't check returncode in tests
This commit is contained in:
parent
1f816bb919
commit
126cb65113
6 changed files with 35 additions and 35 deletions
|
|
@ -45,6 +45,11 @@ def plot_geometry(output=True, openmc_exec='openmc', cwd='.'):
|
|||
cwd : str, optional
|
||||
Path to working directory to run in
|
||||
|
||||
Raises
|
||||
------
|
||||
subprocess.CalledProcessError
|
||||
If the `openmc` executable returns a non-zero status
|
||||
|
||||
"""
|
||||
_run([openmc_exec, '-p'], output, cwd)
|
||||
|
||||
|
|
@ -67,6 +72,11 @@ def plot_inline(plots, openmc_exec='openmc', cwd='.', convert_exec='convert'):
|
|||
convert_exec : str, optional
|
||||
Command that can convert PPM files into PNG files
|
||||
|
||||
Raises
|
||||
------
|
||||
subprocess.CalledProcessError
|
||||
If the `openmc` executable returns a non-zero status
|
||||
|
||||
"""
|
||||
from IPython.display import Image, display
|
||||
|
||||
|
|
@ -125,6 +135,11 @@ def calculate_volumes(threads=None, output=True, cwd='.',
|
|||
Path to working directory to run in. Defaults to the current working
|
||||
directory.
|
||||
|
||||
Raises
|
||||
------
|
||||
subprocess.CalledProcessError
|
||||
If the `openmc` executable returns a non-zero status
|
||||
|
||||
See Also
|
||||
--------
|
||||
openmc.VolumeCalculation
|
||||
|
|
@ -171,8 +186,12 @@ def run(particles=None, threads=None, geometry_debug=False,
|
|||
MPI execute command and any additional MPI arguments to pass,
|
||||
e.g. ['mpiexec', '-n', '8'].
|
||||
|
||||
"""
|
||||
Raises
|
||||
------
|
||||
subprocess.CalledProcessError
|
||||
If the `openmc` executable returns a non-zero status
|
||||
|
||||
"""
|
||||
args = [openmc_exec]
|
||||
|
||||
if isinstance(particles, Integral) and particles > 0:
|
||||
|
|
|
|||
|
|
@ -139,13 +139,10 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
|
||||
if self._opts.mpi_exec is not None:
|
||||
mpi_args = [self._opts.mpi_exec, '-n', self._opts.mpi_np]
|
||||
returncode = openmc.run(openmc_exec=self._opts.exe,
|
||||
mpi_args=mpi_args)
|
||||
openmc.run(openmc_exec=self._opts.exe, mpi_args=mpi_args)
|
||||
|
||||
else:
|
||||
returncode = openmc.run(openmc_exec=self._opts.exe)
|
||||
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
openmc.run(openmc_exec=self._opts.exe)
|
||||
|
||||
sp = openmc.StatePoint('statepoint.' + str(batches) + '.h5')
|
||||
|
||||
|
|
|
|||
|
|
@ -36,13 +36,9 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
# Initial run
|
||||
if self._opts.mpi_exec is not None:
|
||||
mpi_args = [self._opts.mpi_exec, '-n', self._opts.mpi_np]
|
||||
returncode = openmc.run(openmc_exec=self._opts.exe,
|
||||
mpi_args=mpi_args)
|
||||
openmc.run(openmc_exec=self._opts.exe, mpi_args=mpi_args)
|
||||
else:
|
||||
returncode = openmc.run(openmc_exec=self._opts.exe)
|
||||
|
||||
assert returncode == 0, 'CE OpenMC calculation did not exit' \
|
||||
'successfully.'
|
||||
openmc.run(openmc_exec=self._opts.exe)
|
||||
|
||||
# Build MG Inputs
|
||||
# Get data needed to execute Library calculations.
|
||||
|
|
@ -73,10 +69,9 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
# Re-run MG mode.
|
||||
if self._opts.mpi_exec is not None:
|
||||
mpi_args = [self._opts.mpi_exec, '-n', self._opts.mpi_np]
|
||||
returncode = openmc.run(openmc_exec=self._opts.exe,
|
||||
mpi_args=mpi_args)
|
||||
openmc.run(openmc_exec=self._opts.exe, mpi_args=mpi_args)
|
||||
else:
|
||||
returncode = openmc.run(openmc_exec=self._opts.exe)
|
||||
openmc.run(openmc_exec=self._opts.exe)
|
||||
|
||||
def _cleanup(self):
|
||||
super(MGXSTestHarness, self)._cleanup()
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ class PlotTestHarness(TestHarness):
|
|||
self._plot_names = plot_names
|
||||
|
||||
def _run_openmc(self):
|
||||
returncode = openmc.plot_geometry(openmc_exec=self._opts.exe)
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
openmc.plot_geometry(openmc_exec=self._opts.exe)
|
||||
|
||||
def _test_output_created(self):
|
||||
"""Make sure *.ppm has been created."""
|
||||
|
|
|
|||
|
|
@ -50,14 +50,10 @@ class StatepointRestartTestHarness(TestHarness):
|
|||
# Run OpenMC
|
||||
if self._opts.mpi_exec is not None:
|
||||
mpi_args = [self._opts.mpi_exec, '-n', self._opts.mpi_np]
|
||||
returncode = openmc.run(restart_file=statepoint,
|
||||
openmc_exec=self._opts.exe,
|
||||
mpi_args=mpi_args)
|
||||
openmc.run(restart_file=statepoint, openmc_exec=self._opts.exe,
|
||||
mpi_args=mpi_args)
|
||||
else:
|
||||
returncode = openmc.run(openmc_exec=self._opts.exe,
|
||||
restart_file=statepoint)
|
||||
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
openmc.run(openmc_exec=self._opts.exe, restart_file=statepoint)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -62,14 +62,10 @@ class TestHarness(object):
|
|||
|
||||
def _run_openmc(self):
|
||||
if self._opts.mpi_exec is not None:
|
||||
returncode = openmc.run(
|
||||
openmc_exec=self._opts.exe,
|
||||
mpi_args=[self._opts.mpi_exec, '-n', self._opts.mpi_np])
|
||||
|
||||
openmc.run(openmc_exec=self._opts.exe,
|
||||
mpi_args=[self._opts.mpi_exec, '-n', self._opts.mpi_np])
|
||||
else:
|
||||
returncode = openmc.run(openmc_exec=self._opts.exe)
|
||||
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
openmc.run(openmc_exec=self._opts.exe)
|
||||
|
||||
def _test_output_created(self):
|
||||
"""Make sure statepoint.* and tallies.out have been created."""
|
||||
|
|
@ -189,13 +185,11 @@ class ParticleRestartTestHarness(TestHarness):
|
|||
args['mpi_args'] = [self._opts.mpi_exec, '-n', self._opts.mpi_np]
|
||||
|
||||
# Initial run
|
||||
returncode = openmc.run(**args)
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
openmc.run(**args)
|
||||
|
||||
# Run particle restart
|
||||
args.update({'restart_file': self._sp_name})
|
||||
returncode = openmc.run(**args)
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
openmc.run(**args)
|
||||
|
||||
def _test_output_created(self):
|
||||
"""Make sure the restart file has been created."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue