diff --git a/tests/regression_tests/model_xml/test.py b/tests/regression_tests/model_xml/test.py index 9da5438db6..8aa9e5c2e2 100644 --- a/tests/regression_tests/model_xml/test.py +++ b/tests/regression_tests/model_xml/test.py @@ -1,6 +1,8 @@ from difflib import unified_diff +import glob import filecmp import os +from pathlib import Path import openmc import pytest @@ -83,13 +85,17 @@ def test_input_arg(run_in_tmpdir): pincell.export_to_xml(separate_xmls=True) openmc.run() + # make sure the executable isn't falling back on the separate XMLs + [os.remove(f) for f in glob.glob('*.xml')] # now export to a single XML file with a custom name - pincell.export_to_xml(filename='pincell.xml', separate_xmls=False) + pincell.export_to_xml(path='pincell.xml', separate_xmls=False) + assert Path('pincell.xml').exists() # run by specifying that single file - openmc.run(input_file='pincell.xml') + openmc.run(path_input='pincell.xml') # now ensure we get an error for an incorrect filename, # even in the presence of other, valid XML files + pincell.export_to_xml(separate_xmls=True) with pytest.raises(RuntimeError, match='ex-em-ell.xml'): - openmc.run(input_file='ex-em-ell.xml') \ No newline at end of file + openmc.run(path_input='ex-em-ell.xml') \ No newline at end of file diff --git a/tests/unit_tests/test_model.py b/tests/unit_tests/test_model.py index 5d4765d657..11a88d76ce 100644 --- a/tests/unit_tests/test_model.py +++ b/tests/unit_tests/test_model.py @@ -543,7 +543,7 @@ def test_model_xml(run_in_tmpdir): # now write and read a model.xml file pwr_model.export_to_xml(separate_xmls=False) - new_model = openmc.Model.from_xml(separate_xmls=False) + new_model = openmc.Model.from_model_xml() # make sure we can also export this again to separate # XML files @@ -553,17 +553,17 @@ def test_model_exec(run_in_tmpdir): pincell_model = openmc.examples.pwr_pin_cell() - pincell_model.export_to_xml(filename='pwr_pincell.xml', separate_xmls=False) + pincell_model.export_to_xml(path='pwr_pincell.xml', separate_xmls=False) - openmc.run(input_file='pwr_pincell.xml') + openmc.run(path_input='pwr_pincell.xml') with pytest.raises(RuntimeError, match='ex-em-ell.xml'): - openmc.run(input_file='ex-em-ell.xml') + openmc.run(path_input='ex-em-ell.xml') # test that a file in a different directory can be used os.mkdir('inputs') - pincell_model.export_to_xml(directory='./inputs', filename='pincell.xml', separate_xmls=False) - openmc.run(input_file='./inputs/pincell.xml') + pincell_model.export_to_xml(path='./inputs/pincell.xml', separate_xmls=False) + openmc.run(path_input='./inputs/pincell.xml') with pytest.raises(RuntimeError, match='input_dir'): - openmc.run(input_file='input_dir/pincell.xml') \ No newline at end of file + openmc.run(path_input='input_dir/pincell.xml') \ No newline at end of file