diff --git a/tests/integration/test_package_dataset.py b/tests/integration/test_package_dataset.py index 6b066ddc9..cf7a29243 100644 --- a/tests/integration/test_package_dataset.py +++ b/tests/integration/test_package_dataset.py @@ -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: @@ -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)