add generator executor to test fixtures
MODIFY
setup.cfg
setup.cfg
@@ -73,7 +73,7 @@ timeout = 30
timeout_method = signal
markers =
no_executor: Tests that do not use an executor fixture.
- executor_python: Tests that use the Python executor.
+ executor_function: Tests that use the Python function executor.
executor_dask: Tests that use the Dask executor.
executor_prefect: Tests that use the Prefect executor.
executor_prefect_dask: Tests that use the Prefect executor with a Dask cluster.

MODIFY
tests/conftest.py
tests/conftest.py
@@ -459,14 +459,23 @@ def Executor(request):
pytest.skip(f"Couldn't import {request.param}")
-@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.executor_python)])
-def execute_recipe_python():
+@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.executor_function)])
+def execute_recipe_function():
def execute(recipe):
return recipe.to_function()()
return execute
+@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.executor_generator)])
+def execute_recipe_generator():
+ def execute(recipe):
+ for f, args, kwargs in recipe.to_generator():
+ f(*args, **kwargs)
+
+ return execute
+
+
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.executor_dask)])
def execute_recipe_dask(dask_cluster):
def execute(recipe):
@@ -510,7 +519,11 @@ def pytest_collection_modifyitems(items, config):
@pytest.fixture(
- params=[lazy_fixture("execute_recipe_python"), lazy_fixture("execute_recipe_dask")],
+ params=[
+ lazy_fixture("execute_recipe_function"),
+ lazy_fixture("execute_recipe_generator"),
+ lazy_fixture("execute_recipe_dask"),
+ ],
)
def execute_recipe_no_prefect(request):
return request.param
@@ -524,7 +537,7 @@ def execute_recipe_with_prefect(request):
@pytest.fixture(
- params=[lazy_fixture("execute_recipe_python"), lazy_fixture("execute_recipe_prefect")],
+ params=[lazy_fixture("execute_recipe_function"), lazy_fixture("execute_recipe_prefect")],
)
def execute_recipe_no_dask(request):
return request.param

MODIFY
tests/recipe_tests/test_XarrayZarrRecipe.py
tests/recipe_tests/test_XarrayZarrRecipe.py
@@ -315,7 +315,7 @@ def do_actual_chunks_test(
@pytest.mark.parametrize("recipe_fixture", recipes_no_subset)
def test_chunks(
recipe_fixture,
- execute_recipe_python,
+ execute_recipe_function,
inputs_per_chunk,
target_chunks,
error_expectation,
@@ -324,7 +324,7 @@ def test_chunks(
):
do_actual_chunks_test(
recipe_fixture,
- execute_recipe_python,
+ execute_recipe_function,
inputs_per_chunk,
target_chunks,
error_expectation,

add generator executor to test fixtures