Skip to content

Commit

Permalink
Update tests for regions whitelist change
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyh committed May 11, 2022
1 parent 42c3d98 commit c2962f2
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tests/integration/prepare/test_prepare_sentinel_l1.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,26 +431,46 @@ def test_filter_folder_structure_info(
else:
expected_metadata_doc["location"] = f"zip:{input_dataset_path}!/"

# A file with the correct region
regions_file = tmp_path / "our-regions.txt"
regions_file.write_text("\n".join(["55HFA", "55HFB"]))
# A file that doesn't have our region.
non_regions_file = tmp_path / "our-non-regions.txt"
non_regions_file.write_text("\n".join(["55HFB", "55HFC"]))

# Sanity check: no output exists yet.
assert not expected_metadata_path.exists()

# Run with filters that skips this dataset:
# (it should do nothing)

# Filter the region
# Whitelist including the correct region
res = run_prepare_cli(
sentinel_l1_prepare.main,
# It contains our region, so it should filter!
"--limit-regions-file",
"--only-regions-in-file",
regions_file,
# "Put the output in a different location":
"--output-base",
output_folder,
input_dataset_path,
)
assert (
expected_metadata_path.exists()
), f"Expected dataset to be processed (it's within the region file)! {res.output}"
expected_metadata_path.unlink()

# Run with a region list that doesn't include our dataset region.
res = run_prepare_cli(
sentinel_l1_prepare.main,
# It contains our region, so it should filter!
"--only-regions-in-file",
non_regions_file,
# "Put the output in a different location":
"--output-base",
output_folder,
input_dataset_path,
)
assert (
not expected_metadata_path.exists()
), f"Expected dataset to be filtered out! {res.output}"
Expand Down

0 comments on commit c2962f2

Please sign in to comment.