mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-21 06:25:30 -04:00
Skip multipole-related tests if OPENMC_MULTIPOLE_LIBRARY is not set
This commit is contained in:
parent
b7c63be018
commit
848305b8d3
4 changed files with 14 additions and 9 deletions
|
|
@ -2,3 +2,4 @@
|
||||||
python_files = test*.py
|
python_files = test*.py
|
||||||
python_classes = NoThanks
|
python_classes = NoThanks
|
||||||
filterwarnings = ignore::UserWarning
|
filterwarnings = ignore::UserWarning
|
||||||
|
addopts = -rs
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import os
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import openmc
|
import openmc
|
||||||
|
import pytest
|
||||||
|
|
||||||
from tests.testing_harness import PyAPITestHarness
|
from tests.testing_harness import PyAPITestHarness
|
||||||
|
|
||||||
|
|
@ -112,6 +113,9 @@ class DiffTallyTestHarness(PyAPITestHarness):
|
||||||
return df.to_csv(None, columns=cols, index=False, float_format='%.7e')
|
return df.to_csv(None, columns=cols, index=False, float_format='%.7e')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif('OPENMC_MULTIPOLE_LIBRARY' not in os.environ,
|
||||||
|
reason='OPENMC_MULTIPOLE_LIBRARY environment variable '
|
||||||
|
'must be set')
|
||||||
def test_diff_tally():
|
def test_diff_tally():
|
||||||
harness = DiffTallyTestHarness('statepoint.3.h5')
|
harness = DiffTallyTestHarness('statepoint.3.h5')
|
||||||
harness.main()
|
harness.main()
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import os
|
||||||
|
|
||||||
import openmc
|
import openmc
|
||||||
import openmc.model
|
import openmc.model
|
||||||
|
import pytest
|
||||||
|
|
||||||
from tests.testing_harness import TestHarness, PyAPITestHarness
|
from tests.testing_harness import TestHarness, PyAPITestHarness
|
||||||
|
|
||||||
|
|
@ -66,13 +67,6 @@ def make_model():
|
||||||
|
|
||||||
|
|
||||||
class MultipoleTestHarness(PyAPITestHarness):
|
class MultipoleTestHarness(PyAPITestHarness):
|
||||||
def execute_test(self):
|
|
||||||
if not 'OPENMC_MULTIPOLE_LIBRARY' in os.environ:
|
|
||||||
raise RuntimeError("The 'OPENMC_MULTIPOLE_LIBRARY' environment "
|
|
||||||
"variable must be specified for this test.")
|
|
||||||
else:
|
|
||||||
super().execute_test()
|
|
||||||
|
|
||||||
def _get_results(self):
|
def _get_results(self):
|
||||||
outstr = super()._get_results()
|
outstr = super()._get_results()
|
||||||
su = openmc.Summary('summary.h5')
|
su = openmc.Summary('summary.h5')
|
||||||
|
|
@ -80,6 +74,9 @@ class MultipoleTestHarness(PyAPITestHarness):
|
||||||
return outstr
|
return outstr
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif('OPENMC_MULTIPOLE_LIBRARY' not in os.environ,
|
||||||
|
reason='OPENMC_MULTIPOLE_LIBRARY environment variable '
|
||||||
|
'must be set')
|
||||||
def test_multipole():
|
def test_multipole():
|
||||||
model = make_model()
|
model = make_model()
|
||||||
harness = MultipoleTestHarness('statepoint.5.h5', model)
|
harness = MultipoleTestHarness('statepoint.5.h5', model)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
@ -7,6 +5,11 @@ import pytest
|
||||||
import openmc.data
|
import openmc.data
|
||||||
|
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.skipif(
|
||||||
|
'OPENMC_MULTIPOLE_LIBRARY' not in os.environ,
|
||||||
|
reason='OPENMC_MULTIPOLE_LIBRARY environment variable must be set')
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='module')
|
@pytest.fixture(scope='module')
|
||||||
def u235():
|
def u235():
|
||||||
directory = os.environ['OPENMC_MULTIPOLE_LIBRARY']
|
directory = os.environ['OPENMC_MULTIPOLE_LIBRARY']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue