From a95f4cc0d73bbb4b4c025d92caa66d9e5fddd632 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 8 Sep 2022 10:50:09 -0500 Subject: [PATCH] Remove use of _find_chain_file in test_deplete_operator.py --- tests/unit_tests/test_deplete_operator.py | 31 +++-------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/tests/unit_tests/test_deplete_operator.py b/tests/unit_tests/test_deplete_operator.py index 5fe8715ac..6ea89fc4a 100644 --- a/tests/unit_tests/test_deplete_operator.py +++ b/tests/unit_tests/test_deplete_operator.py @@ -1,37 +1,15 @@ """Basic unit tests for openmc.deplete.Operator instantiation -Modifies and resets environment variable OPENMC_CROSS_SECTIONS -to a custom file with new depletion_chain node """ from pathlib import Path -import pytest from openmc.deplete.abc import TransportOperator -from openmc.deplete.chain import Chain, _find_chain_file +from openmc.deplete.chain import Chain -BARE_XS_FILE = "bare_cross_sections.xml" CHAIN_PATH = Path(__file__).parents[1] / "chain_simple.xml" -@pytest.fixture() -def bare_xs(run_in_tmpdir): - """Create a very basic cross_sections file, return simple Chain. - - """ - - bare_xs_contents = """ - - - -""".format(CHAIN_PATH) - - with open(BARE_XS_FILE, "w") as out: - out.write(bare_xs_contents) - - yield BARE_XS_FILE - - class BareDepleteOperator(TransportOperator): """Very basic class for testing the initialization.""" @@ -52,10 +30,10 @@ class BareDepleteOperator(TransportOperator): pass -def test_operator_init(bare_xs): +def test_operator_init(): """The test uses a temporary dummy chain. This file will be removed at the end of the test, and only contains a depletion_chain node.""" - bare_op = BareDepleteOperator(_find_chain_file(bare_xs)) + bare_op = BareDepleteOperator(CHAIN_PATH) act_chain = bare_op.chain ref_chain = Chain.from_xml(CHAIN_PATH) assert len(act_chain) == len(ref_chain) @@ -73,8 +51,7 @@ def test_operator_init(bare_xs): def test_operator_fiss_q(): """Make sure fission q values can be set""" new_q = {"U235": 2.0E8, "U238": 2.0E8, "U234": 5.0E7} - chain_file = Path(__file__).parents[1] / "chain_simple.xml" - operator = BareDepleteOperator(chain_file=chain_file, fission_q=new_q) + operator = BareDepleteOperator(chain_file=CHAIN_PATH, fission_q=new_q) mod_chain = operator.chain for name, q in new_q.items(): chain_nuc = mod_chain[name]