From 3a4a6bef35d20e1849868725d3bfc3c28e71048e Mon Sep 17 00:00:00 2001 From: Frank Zijlstra <22915457+FrankZijlstra@users.noreply.github.com> Date: Fri, 10 Jan 2025 14:15:01 +0100 Subject: [PATCH] Attempt to fix example sequence tests --- tests/test_sequence.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_sequence.py b/tests/test_sequence.py index 807eca45..986bcd4c 100644 --- a/tests/test_sequence.py +++ b/tests/test_sequence.py @@ -232,8 +232,7 @@ def seq4(): # Derive the relative path from the test file to the examples folder examples_dir = Path(__file__).resolve().parents[1] / 'examples' / 'scripts' -for example in seq_examples: - +def make_test_func(example): def test_func(module_name=f'examples.{example}'): spec = importlib.util.spec_from_file_location(module_name, examples_dir / f'{example}.py') # noqa: B023 module = importlib.util.module_from_spec(spec) @@ -241,7 +240,11 @@ def test_func(module_name=f'examples.{example}'): return module.main() test_func.__name__ = example - sequence_zoo.append(test_func) + + return test_func + +for example in seq_examples: + sequence_zoo.append(make_test_func(example) # Main Sequence test class