mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Reset IDs for tests that instantiate models directly
This commit is contained in:
parent
98d5496102
commit
73947ad7de
17 changed files with 32 additions and 27 deletions
|
|
@ -31,7 +31,7 @@ class FixedSourceTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
def test_fixed_source(request):
|
||||
def test_fixed_source(request, reset_ids):
|
||||
mat = openmc.Material()
|
||||
mat.add_nuclide('O16', 1.0)
|
||||
mat.add_nuclide('U238', 0.0001)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from openmc.examples import slab_mg
|
|||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def test_mg_basic(request):
|
||||
def test_mg_basic(request, reset_ids):
|
||||
model = slab_mg()
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from openmc.examples import slab_mg
|
|||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def test_mg_legendre(request):
|
||||
def test_mg_legendre(request, reset_ids):
|
||||
model = slab_mg(reps=['iso'])
|
||||
model.settings.tabular_legendre = {'enable': False}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from openmc.examples import slab_mg
|
|||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def test_mg_max_order(request):
|
||||
def test_mg_max_order(request, reset_ids):
|
||||
model = slab_mg(reps=['iso'])
|
||||
model.settings.max_order = 1
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from openmc.examples import slab_mg
|
|||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def test_mg_nuclide(request):
|
||||
def test_mg_nuclide(request, reset_ids):
|
||||
model = slab_mg(as_macro=False)
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from openmc.examples import slab_mg
|
|||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def test_mg_survival_biasing(request):
|
||||
def test_mg_survival_biasing(request, reset_ids):
|
||||
model = slab_mg()
|
||||
model.settings.survival_biasing = True
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from openmc.examples import slab_mg
|
|||
from tests.testing_harness import HashedPyAPITestHarness
|
||||
|
||||
|
||||
def test_mg_tallies(request):
|
||||
def test_mg_tallies(request, reset_ids):
|
||||
model = slab_mg(as_macro=False)
|
||||
|
||||
# Instantiate a tally mesh
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
from openmc.examples import pwr_pin_cell
|
||||
|
|
@ -52,8 +54,8 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
self._model.materials.export_to_xml()
|
||||
self._model.mgxs_file.export_to_hdf5()
|
||||
# Dont need tallies.xml, so remove the file
|
||||
if os.path.exists('./tallies.xml'):
|
||||
os.remove('./tallies.xml')
|
||||
if os.path.exists('tallies.xml'):
|
||||
os.remove('tallies.xml')
|
||||
|
||||
# Enforce closing statepoint and summary files so HDF5
|
||||
# does not throw an error during the next OpenMC execution
|
||||
|
|
@ -69,12 +71,12 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
|
||||
def _cleanup(self):
|
||||
super(MGXSTestHarness, self)._cleanup()
|
||||
f = os.path.join(os.getcwd(), 'mgxs.h5')
|
||||
f = 'mgxs.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
def test_mgxs_library_ce_to_mg(request):
|
||||
def test_mgxs_library_ce_to_mg(request, reset_ids):
|
||||
# Set the input set to use the pincell model
|
||||
model = pwr_pin_cell()
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
def test_mgxs_library_condense(request):
|
||||
def test_mgxs_library_condense(request, reset_ids):
|
||||
# Use the pincell model
|
||||
model = pwr_pin_cell()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
def test_mgxs_library_distribcell(request):
|
||||
def test_mgxs_library_distribcell(request, reset_ids):
|
||||
model = pwr_assembly()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@ from openmc.examples import pwr_pin_cell
|
|||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
np.set_printoptions(formatter={'float_kind': '{:.8e}'.format})
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
# Generate inputs using parent class routine
|
||||
|
|
@ -76,8 +73,12 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
os.remove(f)
|
||||
|
||||
|
||||
def test_mgxs_library_hdf5(request):
|
||||
model = pwr_pin_cell()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
def test_mgxs_library_hdf5(request, reset_ids):
|
||||
try:
|
||||
np.set_printoptions(formatter={'float_kind': '{:.8e}'.format})
|
||||
model = pwr_pin_cell()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
finally:
|
||||
np.set_printoptions(formatter=None)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_mgxs_library_no_nuclides(request, reset_ids):
|
||||
model = pwr_pin_cell()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_mgxs_library_nuclides(request, reset_ids):
|
||||
model = pwr_pin_cell()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class MultipoleTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
def test_multipole(request):
|
||||
def test_multipole(request, reset_ids):
|
||||
model = make_model()
|
||||
harness = MultipoleTestHarness('statepoint.5.h5', model)
|
||||
harness.request = request
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ def make_model():
|
|||
return model
|
||||
|
||||
|
||||
def test_salphabeta(request):
|
||||
def test_salphabeta(request, reset_ids):
|
||||
model = make_model()
|
||||
harness = PyAPITestHarness('statepoint.5.h5', model)
|
||||
harness.request = request
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from openmc import Mesh, Tally, Tallies
|
|||
from tests.testing_harness import HashedPyAPITestHarness
|
||||
|
||||
|
||||
def test_tallies(request):
|
||||
def test_tallies(request, reset_ids):
|
||||
harness = HashedPyAPITestHarness('statepoint.5.h5')
|
||||
harness.request = request
|
||||
model = harness._model
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class TrackTestHarness(TestHarness):
|
|||
def test_track_output(request):
|
||||
# If vtk python module is not available, we can't run track.py so skip this
|
||||
# test.
|
||||
vtk = pytest.importerskip('vtk')
|
||||
vtk = pytest.importorskip('vtk')
|
||||
harness = TrackTestHarness('statepoint.2.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue