Skip to content

Commit

Permalink
Fixed mission data
Browse files Browse the repository at this point in the history
Nathan Hui committed Mar 3, 2023
1 parent f4907c5 commit b641958
Showing 3 changed files with 15 additions and 12 deletions.
12 changes: 6 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
DataFixture = namedtuple('DataFixture', ['path', 'n_files', 'file_size'])

@pytest.fixture(name='test_app')
def create_mock_test_app() -> MockAppFixture:
def create_test_app() -> MockAppFixture:
"""Creates a mock test app
Yields:
@@ -73,7 +73,7 @@ def create_test_readme() -> Path:

@pytest.fixture(name='single_mission')
def create_single_mission(test_app: Tuple[Mock, DataManager, Path]
) -> Tuple[Tuple[DataManager, Path], Tuple[Path, int, int]]:
) -> Tuple[Mock, DataManager, Path]:
"""Creates a single mission
Args:
@@ -102,12 +102,12 @@ def create_single_mission(test_app: Tuple[Mock, DataManager, Path]
)
)

return app, root_dir
return test_app

@pytest.fixture(name='single_mission_data')
def create_single_mission_data(single_mission: Tuple[DataManager, Path],
def create_single_mission_data(single_mission: Tuple[Mock, DataManager, Path],
test_data: Tuple[Path, int, int]
) -> Tuple[Tuple[DataManager, Path], Tuple[Path, int, int]]:
) -> Tuple[Tuple[Mock, DataManager, Path], Tuple[Path, int, int]]:
"""Creates a single mission
Args:
@@ -117,7 +117,7 @@ def create_single_mission_data(single_mission: Tuple[DataManager, Path],
Returns:
Tuple[Tuple[DataManager, Path], Tuple[Path, int, int]]: test app, test data
"""
app, _ = single_mission
_, app, _ = single_mission
data_dir, _, _ = test_data

app.add(data_dir.rglob('*.bin'))
6 changes: 4 additions & 2 deletions tests/test_duplicate.py
Original file line number Diff line number Diff line change
@@ -3,11 +3,13 @@
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_duplicate(single_mission_data: Tuple[Tuple[DataManager, Path], Tuple[Path, int, int]]):
def test_duplicate(
single_mission_data: Tuple[Tuple[Mock, DataManager, Path], Tuple[Path, int, int]]):
"""Tests duplicating data
Args:
@@ -16,7 +18,7 @@ def test_duplicate(single_mission_data: Tuple[Tuple[DataManager, Path], Tuple[Pa
test_readme (Path): Test Readme
"""
test_app, _ = single_mission_data
app, root_dir = test_app
_, app, root_dir = test_app

with TemporaryDirectory() as duplication_dir:
target = Path(duplication_dir)
9 changes: 5 additions & 4 deletions tests/test_push.py
Original file line number Diff line number Diff line change
@@ -3,13 +3,14 @@
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Tuple
from unittest.mock import Mock

import pytest

from e4e_data_management.core import DataManager


def test_push(single_mission_data: Tuple[Tuple[DataManager, Path], Tuple[Path, int, int]],
def test_push(single_mission_data: Tuple[Tuple[Mock, DataManager, Path], Tuple[Path, int, int]],
test_readme: Path):
"""Tests pushing data
@@ -19,7 +20,7 @@ def test_push(single_mission_data: Tuple[Tuple[DataManager, Path], Tuple[Path, i
test_readme (Path): Test Readme
"""
test_app, _ = single_mission_data
app, _ = test_app
_, app, _ = test_app

app.add([test_readme])
app.commit()
@@ -37,14 +38,14 @@ def test_push(single_mission_data: Tuple[Tuple[DataManager, Path], Tuple[Path, i
'readme.DOCX',
'Readme.docx'
])
def test_valid_readme_names(single_mission: Tuple[DataManager, Path], readme_name: str):
def test_valid_readme_names(single_mission: Tuple[Mock, DataManager, Path], readme_name: str):
"""Tests valid readme names
Args:
test_app (Tuple[DataManager, Path]): Test app
readme_name (str): Readme name
"""
app, _ = single_mission
_, app, _ = single_mission

with TemporaryDirectory() as data_dir:
readme_path = Path(data_dir).joinpath(readme_name)

0 comments on commit b641958

Please sign in to comment.