mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Ability to run regression tests using pytest
This commit is contained in:
parent
72aebfccf2
commit
98d5496102
84 changed files with 351 additions and 639 deletions
4
pytest.ini
Normal file
4
pytest.ini
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[pytest]
|
||||
python_files = test*.py
|
||||
python_classes = NoThanks
|
||||
filterwarnings = ignore::UserWarning
|
||||
|
|
@ -1,13 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class AsymmetricLatticeTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -90,6 +88,7 @@ class AsymmetricLatticeTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_asymmetric_lattice(request):
|
||||
harness = AsymmetricLatticeTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import CMFDTestHarness
|
||||
from tests.testing_harness import CMFDTestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_cmfd_feed(request):
|
||||
harness = CMFDTestHarness('statepoint.20.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import CMFDTestHarness
|
||||
from tests.testing_harness import CMFDTestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_cmfd_nofeed(request):
|
||||
harness = CMFDTestHarness('statepoint.20.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_complex_cell(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_confidence_intervals(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class CreateFissionNeutronsTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -69,6 +65,7 @@ class CreateFissionNeutronsTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_create_fission_neutrons(request):
|
||||
harness = CreateFissionNeutronsTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_density(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pandas as pd
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class DiffTallyTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DiffTallyTestHarness, self).__init__(*args, **kwargs)
|
||||
|
|
@ -125,6 +122,7 @@ class DiffTallyTestHarness(PyAPITestHarness):
|
|||
return df.to_csv(None, columns=cols, index=False, float_format='%.7e')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_diff_tally(request):
|
||||
harness = DiffTallyTestHarness('statepoint.3.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness, PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import TestHarness, PyAPITestHarness
|
||||
|
||||
|
||||
class DistribmatTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -103,6 +99,7 @@ class DistribmatTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_distribmat(request):
|
||||
harness = DistribmatTestHarness('statepoint.5.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_eigenvalue_genperbatch(request):
|
||||
harness = TestHarness('statepoint.7.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_eigenvalue_no_inactive(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class EnergyCutoffTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -73,6 +69,7 @@ class EnergyCutoffTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_energy_cutoff(request):
|
||||
harness = EnergyCutoffTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_energy_grid(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""The purpose of this test is to provide coverage of energy distributions that
|
||||
are not covered in other tests. It has a single material with the following
|
||||
nuclides:
|
||||
|
|
@ -18,13 +16,10 @@ that use linear-linear interpolation.
|
|||
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_energy_laws(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from openmc import Material
|
||||
from openmc.data import NATURAL_ABUNDANCE, atomic_mass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_enrichment():
|
||||
# This test doesn't require an OpenMC run. We just need to make sure the
|
||||
# element.expand() method expands Uranium to the proper enrichment.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
|
||||
from openmc import StatePoint
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class EntropyTestHarness(TestHarness):
|
||||
def _get_results(self):
|
||||
|
|
@ -26,6 +24,7 @@ class EntropyTestHarness(TestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_entropy(request):
|
||||
harness = EntropyTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import hashlib
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import *
|
||||
|
||||
from tests.testing_harness import *
|
||||
|
||||
|
||||
class DistribcellTestHarness(TestHarness):
|
||||
|
|
@ -72,6 +68,7 @@ class DistribcellTestHarness(TestHarness):
|
|||
'Tally output file does not exist.'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_filter_distribcell(request):
|
||||
harness = DistribcellTestHarness()
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class FilterEnergyFunHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -38,8 +33,7 @@ class FilterEnergyFunHarness(PyAPITestHarness):
|
|||
|
||||
def _get_results(self):
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Use tally arithmetic to compute the branching ratio.
|
||||
br_tally = sp.tallies[2] / sp.tallies[1]
|
||||
|
|
@ -48,6 +42,7 @@ class FilterEnergyFunHarness(PyAPITestHarness):
|
|||
return br_tally.get_pandas_dataframe().to_string() + '\n'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_filter_energyfun(request):
|
||||
harness = FilterEnergyFunHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import HashedPyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import HashedPyAPITestHarness
|
||||
|
||||
|
||||
class FilterMeshTestHarness(HashedPyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -67,6 +63,7 @@ class FilterMeshTestHarness(HashedPyAPITestHarness):
|
|||
self._model.tallies.append(tally)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_filter_mesh(request):
|
||||
harness = FilterMeshTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,22 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
import numpy as np
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
import openmc.stats
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class FixedSourceTestHarness(PyAPITestHarness):
|
||||
def _get_results(self):
|
||||
"""Digest info in the statepoint and return as a string."""
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
outstr = ''
|
||||
with openmc.StatePoint(statepoint) as sp:
|
||||
with openmc.StatePoint(self._sp_name) as sp:
|
||||
# Write out tally data.
|
||||
for i, tally_ind in enumerate(sp.tallies):
|
||||
tally = sp.tallies[tally_ind]
|
||||
|
|
@ -36,7 +31,7 @@ class FixedSourceTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_fixed_source(request):
|
||||
mat = openmc.Material()
|
||||
mat.add_nuclide('O16', 1.0)
|
||||
mat.add_nuclide('U238', 0.0001)
|
||||
|
|
@ -61,4 +56,5 @@ if __name__ == '__main__':
|
|||
model.tallies.append(tally)
|
||||
|
||||
harness = FixedSourceTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_infinite_cell(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_iso_in_lab(request):
|
||||
# Force iso-in-lab scattering.
|
||||
harness = PyAPITestHarness('statepoint.10.h5')
|
||||
harness._model.materials.make_isotropic_in_lab()
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_lattice(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_lattice_hex(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_lattice_mixed(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_lattice_multiple(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def test_mg_basic(request):
|
||||
model = slab_mg()
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
|
||||
import numpy as np
|
||||
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 10
|
||||
inactive = 5
|
||||
|
|
@ -202,6 +198,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
self._cleanup()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_mg_convert(request):
|
||||
harness = MGXSTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def test_mg_legendre(request):
|
||||
model = slab_mg(reps=['iso'])
|
||||
model.settings.tabular_legendre = {'enable': False}
|
||||
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def test_mg_max_order(request):
|
||||
model = slab_mg(reps=['iso'])
|
||||
model.settings.max_order = 1
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def test_mg_nuclide(request):
|
||||
model = slab_mg(as_macro=False)
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def test_mg_survival_biasing(request):
|
||||
model = slab_mg()
|
||||
model.settings.survival_biasing = True
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import HashedPyAPITestHarness
|
||||
import openmc
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import HashedPyAPITestHarness
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def test_mg_tallies(request):
|
||||
model = slab_mg(as_macro=False)
|
||||
|
||||
# Instantiate a tally mesh
|
||||
|
|
@ -92,4 +88,5 @@ if __name__ == '__main__':
|
|||
model.tallies.append(t)
|
||||
|
||||
harness = HashedPyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
from openmc.examples import pwr_pin_cell
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -42,8 +37,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
|
||||
# Build MG Inputs
|
||||
# Get data needed to execute Library calculations.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
self.mgxs_lib.load_from_statepoint(sp)
|
||||
self._model.mgxs_file, self._model.materials, \
|
||||
self._model.geometry = self.mgxs_lib.create_mg_mode()
|
||||
|
|
@ -80,9 +74,10 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
os.remove(f)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_mgxs_library_ce_to_mg(request):
|
||||
# Set the input set to use the pincell model
|
||||
model = pwr_pin_cell()
|
||||
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
from openmc.examples import pwr_pin_cell
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -38,8 +34,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Load the MGXS library from the statepoint
|
||||
self.mgxs_lib.load_from_statepoint(sp)
|
||||
|
|
@ -65,8 +60,9 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_mgxs_library_condense(request):
|
||||
# Use the pincell model
|
||||
model = pwr_pin_cell()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
from openmc.examples import pwr_assembly
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -43,8 +39,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Load the MGXS library from the statepoint
|
||||
self.mgxs_lib.load_from_statepoint(sp)
|
||||
|
|
@ -69,7 +64,8 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_mgxs_library_distribcell(request):
|
||||
model = pwr_assembly()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,19 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
|
||||
import numpy as np
|
||||
import h5py
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
from openmc.examples import pwr_pin_cell
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
np.set_printoptions(formatter={'float_kind': '{:.8e}'.format})
|
||||
|
||||
|
|
@ -46,8 +41,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Load the MGXS library from the statepoint
|
||||
self.mgxs_lib.load_from_statepoint(sp)
|
||||
|
|
@ -77,12 +71,13 @@ 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)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_mgxs_library_hdf5(request):
|
||||
model = pwr_pin_cell()
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -47,8 +43,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Load the MGXS library from the statepoint
|
||||
self.mgxs_lib.load_from_statepoint(sp)
|
||||
|
|
@ -70,6 +65,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_mgxs_library_mesh(request):
|
||||
harness = MGXSTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
from openmc.examples import pwr_pin_cell
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -39,8 +35,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Load the MGXS library from the statepoint
|
||||
self.mgxs_lib.load_from_statepoint(sp)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
from openmc.examples import pwr_pin_cell
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -35,8 +31,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Load the MGXS library from the statepoint
|
||||
self.mgxs_lib.load_from_statepoint(sp)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness, PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
import openmc.model
|
||||
|
||||
from tests.testing_harness import TestHarness, PyAPITestHarness
|
||||
|
||||
|
||||
def make_model():
|
||||
model = openmc.model.Model()
|
||||
|
|
@ -81,7 +80,8 @@ class MultipoleTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_multipole(request):
|
||||
model = make_model()
|
||||
harness = MultipoleTestHarness('statepoint.5.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
import glob
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class OutputTestHarness(TestHarness):
|
||||
|
|
@ -21,13 +18,12 @@ class OutputTestHarness(TestHarness):
|
|||
|
||||
def _cleanup(self):
|
||||
TestHarness._cleanup(self)
|
||||
output = glob.glob(os.path.join(os.getcwd(), 'summary.*'))
|
||||
output.append(os.path.join(os.getcwd(), 'cross_sections.out'))
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
f = 'summary.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_output(request):
|
||||
harness = OutputTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import ParticleRestartTestHarness
|
||||
from tests.testing_harness import ParticleRestartTestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_particle_restart_eigval(request):
|
||||
harness = ParticleRestartTestHarness('particle_10_1030.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import ParticleRestartTestHarness
|
||||
from tests.testing_harness import ParticleRestartTestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_particle_restart_fixed(request):
|
||||
harness = ParticleRestartTestHarness('particle_7_144.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class PeriodicTest(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -55,6 +51,7 @@ class PeriodicTest(PyAPITestHarness):
|
|||
settings.export_to_xml()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_periodic(request):
|
||||
harness = PeriodicTest('statepoint.4.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import hashlib
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
|
||||
import h5py
|
||||
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class PlotTestHarness(TestHarness):
|
||||
"""Specialized TestHarness for running OpenMC plotting tests."""
|
||||
|
|
@ -60,7 +56,8 @@ class PlotTestHarness(TestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_plot(request):
|
||||
harness = PlotTestHarness(('plot_1.ppm', 'plot_2.ppm', 'plot_3.ppm',
|
||||
'plot_4.h5'))
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_ptables_off(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_quadric_surfaces(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_reflective_plane(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class ResonanceScatteringTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -46,6 +42,7 @@ class ResonanceScatteringTestHarness(PyAPITestHarness):
|
|||
settings.export_to_xml()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_resonance_scattering(request):
|
||||
harness = ResonanceScatteringTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_rotation(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
import openmc.model
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def make_model():
|
||||
model = openmc.model.Model()
|
||||
|
|
@ -78,7 +73,8 @@ def make_model():
|
|||
return model
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_salphabeta(request):
|
||||
model = make_model()
|
||||
harness = PyAPITestHarness('statepoint.5.h5', model)
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import HashedTestHarness
|
||||
from tests.testing_harness import HashedTestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_score_current(request):
|
||||
harness = HashedTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_seed(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from math import pi
|
||||
import os
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class SourceTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -63,6 +58,7 @@ class SourceTestHarness(PyAPITestHarness):
|
|||
settings.export_to_xml()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_source(request):
|
||||
harness = SourceTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import *
|
||||
|
||||
from tests.testing_harness import *
|
||||
|
||||
|
||||
settings1="""<?xml version="1.0"?>
|
||||
|
|
@ -97,6 +96,7 @@ class SourceFileTestHarness(TestHarness):
|
|||
fh.write(settings1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_source_file(request):
|
||||
harness = SourceFileTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,20 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
|
||||
from openmc import StatePoint
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class SourcepointTestHarness(TestHarness):
|
||||
def _test_output_created(self):
|
||||
"""Make sure statepoint.* files have been created."""
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), 'statepoint.*'))
|
||||
assert len(statepoint) == 5, '5 statepoint files must exist.'
|
||||
assert statepoint[0].endswith('h5'), \
|
||||
'Statepoint file is not a HDF5 file.'
|
||||
"""Make sure statepoint files have been created."""
|
||||
statepoint = glob.glob('statepoint.*.h5')
|
||||
assert len(statepoint) == 5, 'Five statepoint files must exist.'
|
||||
|
||||
def _get_results(self):
|
||||
"""Digest info in the statepoint and return as a string."""
|
||||
|
|
@ -22,8 +17,7 @@ class SourcepointTestHarness(TestHarness):
|
|||
outstr = TestHarness._get_results(self)
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
with StatePoint(statepoint) as sp:
|
||||
with StatePoint(self._sp_name) as sp:
|
||||
# Add the source information.
|
||||
xyz = sp.source[0]['xyz']
|
||||
outstr += ' '.join(['{0:12.6E}'.format(x) for x in xyz])
|
||||
|
|
@ -32,6 +26,7 @@ class SourcepointTestHarness(TestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_sourcepoint_batch(request):
|
||||
harness = SourcepointTestHarness('statepoint.08.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,22 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class SourcepointTestHarness(TestHarness):
|
||||
def _test_output_created(self):
|
||||
"""Make sure statepoint.* and source* have been created."""
|
||||
TestHarness._test_output_created(self)
|
||||
source = glob.glob(os.path.join(os.getcwd(), 'source.*'))
|
||||
source = glob.glob(os.path.join(os.getcwd(), 'source.*.h5'))
|
||||
assert len(source) == 1, 'Either multiple or no source files ' \
|
||||
'exist.'
|
||||
assert source[0].endswith('h5'), \
|
||||
'Source file is not a HDF5 file.'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_sourcepoint_latest(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_sourcepoint_restart(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class StatepointTestHarness(TestHarness):
|
||||
|
|
@ -18,6 +13,7 @@ class StatepointTestHarness(TestHarness):
|
|||
TestHarness._test_output_created(self)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_statepoint_batch(request):
|
||||
harness = StatepointTestHarness()
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class StatepointRestartTestHarness(TestHarness):
|
||||
def __init__(self, final_sp, restart_sp):
|
||||
|
|
@ -56,7 +54,8 @@ class StatepointRestartTestHarness(TestHarness):
|
|||
openmc.run(openmc_exec=self._opts.exe, restart_file=statepoint)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_statepoint_restart(request):
|
||||
harness = StatepointRestartTestHarness('statepoint.10.h5',
|
||||
'statepoint.07.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,30 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class SourcepointTestHarness(TestHarness):
|
||||
def _test_output_created(self):
|
||||
"""Make sure statepoint.* and source* have been created."""
|
||||
TestHarness._test_output_created(self)
|
||||
source = glob.glob(os.path.join(os.getcwd(), 'source.*'))
|
||||
source = glob.glob('source.*.h5')
|
||||
assert len(source) == 1, 'Either multiple or no source files ' \
|
||||
'exist.'
|
||||
assert source[0].endswith('h5'), \
|
||||
'Source file is not a HDF5 file.'
|
||||
|
||||
def _cleanup(self):
|
||||
TestHarness._cleanup(self)
|
||||
output = glob.glob(os.path.join(os.getcwd(), 'source.*'))
|
||||
output = glob.glob('source.*.h5')
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_statepoint_sourcesep(request):
|
||||
harness = SourcepointTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import numpy as np
|
||||
import openmc
|
||||
import pandas as pd
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class SurfaceTallyTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -178,6 +174,7 @@ class SurfaceTallyTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_surface_tally(request):
|
||||
harness = SurfaceTallyTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_survival_biasing(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
|
||||
from testing_harness import HashedPyAPITestHarness
|
||||
from openmc.filter import *
|
||||
from openmc import Mesh, Tally, Tallies
|
||||
|
||||
from tests.testing_harness import HashedPyAPITestHarness
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def test_tallies(request):
|
||||
harness = HashedPyAPITestHarness('statepoint.5.h5')
|
||||
harness.request = request
|
||||
model = harness._model
|
||||
|
||||
# Set settings explicitly
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class TallyAggregationTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -28,8 +24,7 @@ class TallyAggregationTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Extract the tally of interest
|
||||
tally = sp.get_tally(name='distribcell tally')
|
||||
|
|
@ -66,6 +61,7 @@ class TallyAggregationTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_tally_aggregation(request):
|
||||
harness = TallyAggregationTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class TallyArithmeticTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -43,8 +39,7 @@ class TallyArithmeticTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Load the tallies
|
||||
tally_1 = sp.get_tally(name='tally 1')
|
||||
|
|
@ -80,6 +75,7 @@ class TallyArithmeticTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_tally_arithmetic(request):
|
||||
harness = TallyArithmeticTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_tally_assumesep(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_tally_nuclides(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
import itertools
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class TallySliceMergeTestHarness(PyAPITestHarness):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -85,8 +81,7 @@ class TallySliceMergeTestHarness(PyAPITestHarness):
|
|||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
sp = openmc.StatePoint(self._sp_name)
|
||||
|
||||
# Extract the cell tally
|
||||
tallies = [sp.get_tally(name='cell tally')]
|
||||
|
|
@ -171,6 +166,7 @@ class TallySliceMergeTestHarness(PyAPITestHarness):
|
|||
return outstr
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_tally_slice_merge(request):
|
||||
harness = TallySliceMergeTestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_trace(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
from subprocess import call
|
||||
import shutil
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
class TrackTestHarness(TestHarness):
|
||||
|
|
@ -39,14 +38,10 @@ class TrackTestHarness(TestHarness):
|
|||
os.remove(f)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_track_output(request):
|
||||
# If vtk python module is not available, we can't run track.py so skip this
|
||||
# test.
|
||||
try:
|
||||
import vtk
|
||||
except ImportError:
|
||||
print('----------------Skipping test-------------')
|
||||
shutil.copy('results_true.dat', 'results_test.dat')
|
||||
exit()
|
||||
vtk = pytest.importerskip('vtk')
|
||||
harness = TrackTestHarness('statepoint.2.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_translation(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_trigger_batch_interval(request):
|
||||
harness = TestHarness('statepoint.15.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_trigger_no_batch_interval(request):
|
||||
harness = TestHarness('statepoint.15.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_trigger_no_status(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_trigger_tallies(request):
|
||||
harness = TestHarness('statepoint.15.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import random
|
||||
from math import sqrt
|
||||
|
||||
import numpy as np
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
import openmc.model
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class TRISOTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -96,6 +90,7 @@ class TRISOTestHarness(PyAPITestHarness):
|
|||
mats.export_to_xml()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_triso(request):
|
||||
harness = TRISOTestHarness('statepoint.5.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_uniform_fs(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_universe(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import TestHarness
|
||||
from tests.testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_void(request):
|
||||
harness = TestHarness('statepoint.10.h5')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
from testing_harness import PyAPITestHarness
|
||||
|
||||
import openmc
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class VolumeTest(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
|
@ -57,8 +56,7 @@ class VolumeTest(PyAPITestHarness):
|
|||
|
||||
def _get_results(self):
|
||||
outstr = ''
|
||||
for i, filename in enumerate(sorted(glob.glob(os.path.join(
|
||||
os.getcwd(), 'volume_*.h5')))):
|
||||
for i, filename in enumerate(sorted(glob.glob('volume_*.h5'))):
|
||||
outstr += 'Volume calculation {}\n'.format(i)
|
||||
|
||||
# Read volume calculation results
|
||||
|
|
@ -75,6 +73,7 @@ class VolumeTest(PyAPITestHarness):
|
|||
def _test_output_created(self):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
def test_volume_calc(request):
|
||||
harness = VolumeTest('')
|
||||
harness.request = request
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import sys
|
|||
|
||||
import numpy as np
|
||||
|
||||
sys.path.insert(0, os.path.join(os.pardir, os.pardir))
|
||||
import openmc
|
||||
from openmc.examples import pwr_core
|
||||
|
||||
|
|
@ -33,10 +32,14 @@ class TestHarness(object):
|
|||
def main(self):
|
||||
"""Accept commandline arguments and either run or update tests."""
|
||||
(self._opts, self._args) = self.parser.parse_args()
|
||||
if self._opts.update:
|
||||
self.update_results()
|
||||
else:
|
||||
self.execute_test()
|
||||
try:
|
||||
olddir = self.request.fspath.dirpath().chdir()
|
||||
if self._opts.update:
|
||||
self.update_results()
|
||||
else:
|
||||
self.execute_test()
|
||||
finally:
|
||||
olddir.chdir()
|
||||
|
||||
def execute_test(self):
|
||||
"""Run OpenMC with the appropriate arguments and check the outputs."""
|
||||
|
|
@ -234,6 +237,7 @@ class PyAPITestHarness(TestHarness):
|
|||
super(PyAPITestHarness, self).__init__(statepoint_name)
|
||||
self.parser.add_option('-b', '--build-inputs', dest='build_only',
|
||||
action='store_true', default=False)
|
||||
openmc.reset_auto_ids()
|
||||
if model is None:
|
||||
self._model = pwr_core()
|
||||
else:
|
||||
|
|
@ -244,12 +248,16 @@ class PyAPITestHarness(TestHarness):
|
|||
def main(self):
|
||||
"""Accept commandline arguments and either run or update tests."""
|
||||
(self._opts, self._args) = self.parser.parse_args()
|
||||
if self._opts.build_only:
|
||||
self._build_inputs()
|
||||
elif self._opts.update:
|
||||
self.update_results()
|
||||
else:
|
||||
self.execute_test()
|
||||
try:
|
||||
olddir = self.request.fspath.dirpath().chdir()
|
||||
if self._opts.build_only:
|
||||
self._build_inputs()
|
||||
elif self._opts.update:
|
||||
self.update_results()
|
||||
else:
|
||||
self.execute_test()
|
||||
finally:
|
||||
olddir.chdir()
|
||||
|
||||
def execute_test(self):
|
||||
"""Build input XMLs, run OpenMC, and verify correct results."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue