From b2d2f6e45a661d9cb1efbf75a9061a8884792616 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Mon, 22 Jul 2024 09:15:48 +0200 Subject: [PATCH 1/2] Test batch_run examples in CI Add a function to test the batch_run examples, which is also ran in CI. --- tests/test_examples.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_examples.py b/tests/test_examples.py index e5c0381f065..4e3a27fd4ca 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -66,3 +66,13 @@ def test_examples(self): model = model_class() for _ in range(10): model.step() + + def test_batch_run(self): + examples_to_test = { + 'bank_reserves': 'batch_run', + 'sugarscape_g1mt': 'run' + } + for example, script in examples_to_test.items(): + with self.active_example_dir(example): + script_module = importlib.import_module(script) + script_module.main() # Assuming the scripts have a main function From 7622bd9b9e0dc44f1dd0e892ec3c48e5cce55632 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 07:16:55 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_examples.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_examples.py b/tests/test_examples.py index 4e3a27fd4ca..daf3956a259 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -68,10 +68,7 @@ def test_examples(self): model.step() def test_batch_run(self): - examples_to_test = { - 'bank_reserves': 'batch_run', - 'sugarscape_g1mt': 'run' - } + examples_to_test = {"bank_reserves": "batch_run", "sugarscape_g1mt": "run"} for example, script in examples_to_test.items(): with self.active_example_dir(example): script_module = importlib.import_module(script)