From 400fb9d9d485159bf077659adc5caa5a5457b418 Mon Sep 17 00:00:00 2001 From: Robbi Bishop-Taylor Date: Tue, 19 Nov 2024 23:45:15 +0000 Subject: [PATCH] Update tests to remove temp dir --- .gitignore | 1 + tests/test_utils.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 2c9efd0..bf44d07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Ignore project-specific directories tests/data/tide_models +tests/data/tide_models_clipped docs/source # From https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore diff --git a/tests/test_utils.py b/tests/test_utils.py index 17d2b37..043120f 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -53,13 +53,16 @@ def test_standardise_models(model, ensemble_models, exp_process, exp_request, ex def test_clip_models(): - with tempfile.TemporaryDirectory() as tmpdirname: - clip_models( - input_directory="tests/data/tide_models", output_directory=tmpdirname, bbox=(122.27, -18.07, 122.29, -18.05) - ) + out_dir = pathlib.Path("tests/data/tide_models_clipped") - output_files = set([i.stem for i in pathlib.Path(tmpdirname).iterdir()]) - assert output_files == set(["GOT5", "EOT20", "hamtide"]) + clip_models( + input_directory="tests/data/tide_models", + output_directory=out_dir, + bbox=(122.27, -18.07, 122.29, -18.05), + ) + + output_files = set([i.stem for i in out_dir.iterdir()]) + assert output_files == set(["GOT5", "EOT20", "hamtide"]) @pytest.mark.parametrize(