Skip to content

Commit 41b70e3

Browse files
Merge pull request #31 from MITLibraries/TIMX-425-update-load-dataset-and-apply-filtering
Timx 425 update load dataset and apply filtering; Timx 440 replace static fixture of local dataset
2 parents e1c0c6a + 3e5e707 commit 41b70e3

11 files changed

Lines changed: 596 additions & 244 deletions

File tree

Pipfile.lock

Lines changed: 57 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ classifiers = [
2222
]
2323

2424
dependencies = [
25+
"attrs",
2526
"boto3",
2627
"duckdb",
2728
"pandas",

tests/conftest.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
import pytest
77

8-
from tests.utils import generate_sample_records
8+
from tests.utils import (
9+
generate_sample_records,
10+
generate_sample_records_with_simulated_partitions,
11+
)
912
from timdex_dataset_api import TIMDEXDataset
1013

1114

@@ -19,19 +22,35 @@ def _test_env(monkeypatch):
1922

2023

2124
@pytest.fixture
22-
def local_dataset_location():
23-
return "tests/fixtures/local_datasets/dataset"
25+
def local_dataset_location(tmp_path):
26+
return str(tmp_path / "local_dataset/")
2427

2528

2629
@pytest.fixture
2730
def local_dataset(local_dataset_location):
28-
return TIMDEXDataset.load(local_dataset_location)
31+
timdex_dataset = TIMDEXDataset(local_dataset_location)
32+
timdex_dataset.write(
33+
generate_sample_records_with_simulated_partitions(num_records=5_000)
34+
)
35+
timdex_dataset.load()
36+
return timdex_dataset
2937

3038

3139
@pytest.fixture
32-
def new_dataset(tmp_path) -> TIMDEXDataset:
33-
location = str(tmp_path / "new_dataset")
34-
return TIMDEXDataset(location=location)
40+
def new_local_dataset(tmp_path) -> TIMDEXDataset:
41+
return TIMDEXDataset(location=str(tmp_path / "new_local_dataset/"))
42+
43+
44+
@pytest.fixture
45+
def fixed_local_dataset(tmp_path) -> TIMDEXDataset:
46+
"""Local dataset with a fixed set of configurations.
47+
48+
This fixture is required to perform unit tests for TIMDEXDataset.filter
49+
method.
50+
"""
51+
timdex_dataset = TIMDEXDataset(str(tmp_path / "fixed_local_dataset/"))
52+
timdex_dataset.write(generate_sample_records(num_records=5_000, run_id="abc123"))
53+
return timdex_dataset
3554

3655

3756
@pytest.fixture

0 commit comments

Comments
 (0)