From 7af1707712a4c8c138df292896f490b3561cb32a Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 21 Aug 2024 22:44:15 -0500 Subject: [PATCH] Test corrections. Support handling separate XML files or a model XML file --- src/openmc_cad_adapter/to_cubit_journal.py | 4 +++- test/test_examples.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/openmc_cad_adapter/to_cubit_journal.py b/src/openmc_cad_adapter/to_cubit_journal.py index d10a8d2..98d6ba5 100644 --- a/src/openmc_cad_adapter/to_cubit_journal.py +++ b/src/openmc_cad_adapter/to_cubit_journal.py @@ -948,7 +948,9 @@ def openmc_to_cad(): model_path = Path(args.input) if model_path.is_dir(): - model = openmc.Model.from_xml(model_path) + if not (model_path / 'settings.xml').exists(): + raise IOError(f'Unable to locate settings.xml in {model_path}') + model = openmc.Model.from_xml(*[model_path / f for f in ('geometry.xml', 'materials.xml', 'settings.xml')]) else: model = openmc.Model.from_model_xml(model_path) diff --git a/test/test_examples.py b/test/test_examples.py index e9f3a43..d6a3195 100644 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -56,9 +56,10 @@ def test_examples_cli(example, request): example_path = OPENMC_EXAMPLES_DIR / example exec(open(example_path).read()) + openmc.reset_auto_ids() world = [500, 500, 500] output = example_name(example) - cmd = ['openmc_to_cad', example_path.parent, '-o', output, '--world'] + [str(w) for w in world] + cmd = ['openmc_to_cad', '.', '-o', output, '--world'] + [str(w) for w in world] pipe = subprocess.Popen(cmd) pipe.wait() if pipe.returncode != 0: