Skip to content

Commit

Permalink
Split hoisted assertions out into seperate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Staberinde committed Apr 6, 2022
1 parent 7e4979a commit d98504d
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion tests/integration/test_package_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def test_package_dataset(
)
api.dataset_create_cmd(input_paths, sqlite_path, organisation_path)
api.dataset_dump_cmd(sqlite_path, csv_path)
api.dataset_dump_hoisted_cmd(csv_path, hoisted_csv_path)

# Assert
with csv_path.open() as actual, expected_csv_result.open() as expected:
Expand All @@ -129,6 +128,43 @@ def test_package_dataset(
assert actual_dict_reader.fieldnames == expected_dict_reader.fieldnames
assert list(actual_dict_reader) == list(expected_dict_reader)


@pytest.mark.parametrize(
"dataset_name",
[
"listed-building-grade",
"listed-building-outline",
"locally-listed-building",
],
)
def test_package_dataset_hoisted(
# Parametrize args
dataset_name,
# Runtime filesystem dependencies generated by previous steps
pipeline_dir,
# Test assertion directories
dataset_dir,
# Pytest fixtures
tmp_path,
):
# Setup
expected_hoisted_csv_result = dataset_dir.joinpath(f"{dataset_name}-hoisted.csv")

csv_path = dataset_dir.joinpath(f"{dataset_name}.csv")

output_dir = tmp_path.joinpath("dataset_output")
output_dir.mkdir()
hoisted_csv_path = output_dir.joinpath(f"{dataset_name}-hoisted.csv")

# Call
api = DigitalLandApi(
debug=False,
dataset=dataset_name,
pipeline_dir=pipeline_dir,
specification_dir=str(specification_path),
)
api.dataset_dump_hoisted_cmd(csv_path, hoisted_csv_path)

with hoisted_csv_path.open() as actual, expected_hoisted_csv_result.open() as expected:
actual_dict_reader = DictReader(actual)
expected_dict_reader = DictReader(expected)
Expand Down

0 comments on commit d98504d

Please sign in to comment.