Skip to content

Commit

Permalink
Merge branch '34-remove-dataset-after-pushing-to-server' into 37-zip-…
Browse files Browse the repository at this point in the history
…command
  • Loading branch information
ntlhui committed Dec 16, 2024
2 parents 6bb26e7 + 0d795f7 commit 751363a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions tests/test_purge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''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

0 comments on commit 751363a

Please sign in to comment.