Skip to content

Commit 00edc77

Browse files
GuyStenpaulromano
andauthored
Change test order to run unit tests first. (#3533)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
1 parent ec15803 commit 00edc77

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

openmc/cell.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ def plot(self, *args, **kwargs):
567567
.. versionadded:: 0.14.0
568568
"""
569569
# Create dummy universe but preserve used_ids
570-
next_id = openmc.Universe.next_id
570+
next_id = openmc.UniverseBase.next_id
571571
u = openmc.Universe(cells=[self])
572-
openmc.Universe.used_ids.remove(u.id)
573-
openmc.Universe.next_id = next_id
572+
openmc.UniverseBase.used_ids.remove(u.id)
573+
openmc.UniverseBase.next_id = next_id
574574
return u.plot(*args, **kwargs)
575575

576576
def create_xml_subelement(self, xml_element, memo=None):

openmc/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def patch(self, key: str, value: Any):
178178
self[key] = previous_value
179179

180180

181-
def _default_config() -> _Config:
181+
def _default_config(**kwargs) -> _Config:
182182
"""Create a configuration initialized from environment variables.
183183
184184
This function checks for OPENMC_CROSS_SECTIONS, OPENMC_MG_CROSS_SECTIONS,
@@ -192,11 +192,11 @@ def _default_config() -> _Config:
192192
A new configuration object.
193193
194194
"""
195-
config = _Config()
195+
config = _Config(kwargs)
196196
for key,var in _Config._PATH_KEYS.items():
197197
if var in os.environ:
198198
config[key] = os.environ[var]
199-
199+
200200
chain_file = config.get("chain_file")
201201
xs_path = config.get("cross_sections")
202202
if chain_file is None and xs_path is not None and xs_path.exists():

tests/unit_tests/test_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def reset_config_and_env():
1313
"""A fixture to ensure each test has a clean config, env, and CWD."""
1414
original_env = dict(os.environ)
1515
original_cwd = os.getcwd()
16+
original_resolve_paths = openmc.config["resolve_paths"]
1617

1718
# Reset environment variables that affect config
1819
for key in ['OPENMC_CROSS_SECTIONS', 'OPENMC_MG_CROSS_SECTIONS', 'OPENMC_CHAIN_FILE']:
@@ -25,13 +26,13 @@ def reset_config_and_env():
2526
try:
2627
yield
2728
finally:
28-
# Restore environment and CWD
29+
# Restore environment, CWD and resolve_paths
2930
os.environ.clear()
3031
os.environ.update(original_env)
3132
os.chdir(original_cwd)
3233

3334
# Restore config one last time for safety between modules
34-
openmc.config = _default_config()
35+
openmc.config = _default_config(resolve_paths=original_resolve_paths)
3536

3637

3738
def test_config_basics():

tools/ci/gha-script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ if [[ $EVENT == 'y' ]]; then
1414
args="${args} --event "
1515
fi
1616

17-
# Run regression and unit tests
18-
pytest --cov=openmc -v $args tests
17+
# Run unit tests and then regression tests
18+
pytest --cov=openmc -v $args tests/unit_tests tests/regression_tests

0 commit comments

Comments
 (0)