From a98cfead653cc847af04ae90ee23371062e91347 Mon Sep 17 00:00:00 2001 From: Nathan Hui Date: Sun, 15 Dec 2024 17:23:29 -0800 Subject: [PATCH 1/3] docs: Documents fixture --- tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 38c14b3..8fb1435 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -130,7 +130,8 @@ def create_single_mission_data(single_mission: Tuple[Mock, DataManager, Path], test_data (Tuple[Path, int, int]): Test Data Returns: - Tuple[Tuple[DataManager, Path], Tuple[Path, int, int]]: test app, test data + Tuple[Tuple[DataManager, Path], Tuple[Path, int, int]]: ((mocked application, data manager, + root directory), (data path, number of files, file size)) """ _, app, _ = single_mission data_dir, _, _ = test_data From 31173a1ad25897de965548767d7cbbf42fb85f36 Mon Sep 17 00:00:00 2001 From: Nathan Hui Date: Sun, 15 Dec 2024 17:23:37 -0800 Subject: [PATCH 2/3] ci: Tests for prune behavior --- tests/test_purge.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/test_purge.py diff --git a/tests/test_purge.py b/tests/test_purge.py new file mode 100644 index 0000000..1090161 --- /dev/null +++ b/tests/test_purge.py @@ -0,0 +1,29 @@ +'''Test purging files +''' +from pathlib import Path +from tempfile import TemporaryDirectory +from typing import Tuple +from unittest.mock import Mock + +from e4e_data_management.core import DataManager + + +def test_purge(single_mission_data: Tuple[Tuple[Mock, DataManager, Path], Tuple[Path, int, int]], + test_readme: Path): + """Tests purging data + + Args: + single_mission_data (Tuple[Tuple[Mock, DataManager, Path], Tuple[Path, int, int]]): Test Data + test_readme (Path): Test Readme + """ + app_fixture, _ = single_mission_data + _, app, root_dir = app_fixture + + app.add([test_readme], readme=True) + app.commit(readme=True) + + with TemporaryDirectory() as push_dir: + app.push(Path(push_dir)) + assert len(list(root_dir.glob('2023.03.02.Test.San Diego'))) == 1 + app.prune() + assert len(list(root_dir.glob('2023.03.02.Test.San Diego'))) == 0 From 0d795f73b470b4824cbe9cac06dd52eb879ba1a3 Mon Sep 17 00:00:00 2001 From: Nathan Hui Date: Sun, 15 Dec 2024 17:24:45 -0800 Subject: [PATCH 3/3] style: Fixes long line --- tests/test_purge.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_purge.py b/tests/test_purge.py index 1090161..8342e57 100644 --- a/tests/test_purge.py +++ b/tests/test_purge.py @@ -13,7 +13,8 @@ def test_purge(single_mission_data: Tuple[Tuple[Mock, DataManager, Path], Tuple[ """Tests purging data Args: - single_mission_data (Tuple[Tuple[Mock, DataManager, Path], Tuple[Path, int, int]]): Test Data + single_mission_data (Tuple[Tuple[Mock, DataManager, Path], Tuple[Path, int, int]]): Test + Data test_readme (Path): Test Readme """ app_fixture, _ = single_mission_data