Skip to content

Commit 9ff7594

Browse files
committed
Always prefix with source in test util
1 parent 5a582c0 commit 9ff7594

3 files changed

Lines changed: 2 additions & 22 deletions

File tree

tests/conftest.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def fixed_local_dataset(tmp_path) -> TIMDEXDataset:
6262
timdex_dataset.write(
6363
generate_sample_records(
6464
num_records=1_000,
65-
timdex_record_id_prefix=source,
6665
source=source,
6766
run_date="2024-12-01",
6867
run_id=run_id,
@@ -82,19 +81,6 @@ def _records_iter(num_records):
8281
return _records_iter
8382

8483

85-
@pytest.fixture
86-
def sample_records_iter_without_partitions():
87-
"""Simulates an iterator of X number of DatasetRecord instances WITHOUT partition
88-
values included."""
89-
90-
def _records_iter(num_records):
91-
return generate_sample_records(
92-
num_records, run_date="invalid run-date", year=None, month=None, day=None
93-
)
94-
95-
return _records_iter
96-
97-
9884
@pytest.fixture
9985
def dataset_with_runs_location(tmp_path) -> str:
10086
"""Fixture to simulate a dataset with multiple full and daily ETL runs."""
@@ -139,7 +125,6 @@ def dataset_with_runs_location(tmp_path) -> str:
139125
num_records, source, run_date, run_type, action, run_id = params
140126
records = generate_sample_records(
141127
num_records,
142-
timdex_record_id_prefix=source,
143128
source=source,
144129
run_date=run_date,
145130
run_type=run_type,
@@ -195,7 +180,6 @@ def dataset_with_same_day_runs(tmp_path) -> TIMDEXDataset:
195180
num_records, source, run_date, run_type, action, run_id, run_timestamp = params
196181
records = generate_sample_records(
197182
num_records,
198-
timdex_record_id_prefix=source,
199183
source=source,
200184
run_date=run_date,
201185
run_type=run_type,

tests/test_write.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ def test_dataset_write_partition_for_multiple_sources(
9898

9999
# perform write for source="libguides" and run_date="2024-12-01"
100100
written_files_source_b = new_local_dataset.write(
101-
generate_sample_records(
102-
num_records=7, timdex_record_id_prefix="libguides", source="libguides"
103-
)
101+
generate_sample_records(num_records=7, source="libguides")
104102
)
105103
new_local_dataset.load()
106104

tests/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
def generate_sample_records(
1313
num_records: int,
14-
timdex_record_id_prefix: str = "alma",
1514
source: str | None = "alma",
1615
run_date: str | None = "2024-12-01",
1716
run_type: str | None = "daily",
@@ -25,7 +24,7 @@ def generate_sample_records(
2524

2625
for x in range(num_records):
2726
yield DatasetRecord(
28-
timdex_record_id=f"{timdex_record_id_prefix}:{x}",
27+
timdex_record_id=f"{source}:{x}",
2928
source_record=b"<record><title>Hello World.</title></record>",
3029
transformed_record=b"""{"title":["Hello World."]}""",
3130
source=source,
@@ -53,7 +52,6 @@ def generate_sample_records_with_simulated_partitions(
5352
source = random.choice(sources)
5453
yield from generate_sample_records(
5554
num_records=batch_size,
56-
timdex_record_id_prefix=source,
5755
source=source,
5856
run_date=random.choice(run_dates),
5957
run_type=random.choice(run_types),

0 commit comments

Comments
 (0)