From ee2f0f2c53048bb7dafed8f270cad2668ea5da14 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 16 Feb 2023 13:48:28 -0600 Subject: [PATCH] Adding a test for restart runs --- tests/unit_tests/test_restart.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/unit_tests/test_restart.py diff --git a/tests/unit_tests/test_restart.py b/tests/unit_tests/test_restart.py new file mode 100644 index 0000000000..f2d99e0820 --- /dev/null +++ b/tests/unit_tests/test_restart.py @@ -0,0 +1,23 @@ +import openmc + +import pytest + +def test_restart(run_in_tmpdir): + + pincell = openmc.examples.pwr_pin_cell() + + # run the pincell + sp_file = pincell.run() + + # run a restart with the resulting statepoint + # and the settings unchanged + + with pytest.raises(RuntimeError, match='is smaller than the number of batches'): + pincell.run(restart_file=sp_file) + + # update the number of batches and run again + pincell.settings.batches = 15 + sp_file = pincell.run(restart_file=sp_file) + + sp = openmc.StatePoint(sp_file) + assert sp.n_batches == 15 \ No newline at end of file