From adf73de29cd81ed56cad99f067995c6b6bf15933 Mon Sep 17 00:00:00 2001 From: Bart Schilperoort Date: Wed, 10 Jul 2024 10:49:19 +0200 Subject: [PATCH] Make tests use dask distributed scheduler --- pyproject.toml | 2 +- tests/test_datasets/test_fapar_lai.py | 3 +++ tests/test_recipes/test_simple_recipe.py | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4a178f3..6331e99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,7 +134,7 @@ python_version = "3.10" [tool.ruff] line-length = 88 -exclude = ["docs", "build"] +exclude = ["docs", "build", "tests"] target-version = "py310" [tool.ruff.lint] diff --git a/tests/test_datasets/test_fapar_lai.py b/tests/test_datasets/test_fapar_lai.py index 2db36e9..f9a5d58 100644 --- a/tests/test_datasets/test_fapar_lai.py +++ b/tests/test_datasets/test_fapar_lai.py @@ -10,6 +10,7 @@ from zampy.datasets.dataset_protocol import SpatialBounds from zampy.datasets.dataset_protocol import TimeBounds from . import data_folder +import dask.distributed @pytest.fixture(scope="function") @@ -86,6 +87,8 @@ def test_download(self, mock_retrieve, valid_path_config, dummy_dir): @pytest.mark.slow def test_ingest(self, dummy_dir): """Test ingest function.""" + dask.distributed.Client() + ingest_dir = Path(dummy_dir) / "ingest" ingest_dir.mkdir() diff --git a/tests/test_recipes/test_simple_recipe.py b/tests/test_recipes/test_simple_recipe.py index 2c8076a..a00bc20 100644 --- a/tests/test_recipes/test_simple_recipe.py +++ b/tests/test_recipes/test_simple_recipe.py @@ -12,6 +12,8 @@ from zampy.datasets.dataset_protocol import write_properties_file from zampy.recipe import RecipeManager from zampy.recipe import convert_time +import dask.distributed + RECIPE_FILE = Path(__file__).parent / "recipes" / "era5_recipe.yml" @@ -21,6 +23,8 @@ def test_recipe(tmp_path: Path, mocker): with ( patch.object(DATASETS["era5"], "download"), ): + dask.distributed.Client() + mocker.patch( "zampy.recipe.config_loader", return_value={"working_directory": str(tmp_path.absolute())},