Skip to content

Commit

Permalink
Update tests for metadata as a folder sibling
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyh committed May 20, 2022
1 parent 0a2ba64 commit c187b77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion eodatasets3/prepare/sentinel_l1_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def prepare_and_write(
) -> Tuple[DatasetDoc, Path]:
if embed_location is None:
# Default to embedding the location if they're not in the same folder.
embed_location = dataset_location.parent != output_yaml.parent
embed_location = output_yaml.parent not in dataset_location.parents
_LOG.debug(
"Auto-embed location? %s: %s %s %s",
"Yes" if embed_location else "No",
Expand Down
13 changes: 4 additions & 9 deletions tests/integration/prepare/test_prepare_sentinel_l1.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,11 @@ def dataset_input_output(request, tmp_path):

if input_dataset_path.is_dir():
shutil.copytree(input_dataset_path, unique_in_path)
# A folder input expects a metadata file inside.
expected_metadata_path = (
tmp_path / input_dataset_path.name / expected_metadata_name
)
else:
shutil.copy(input_dataset_path, unique_in_path)
# A file expects a sibling metadata path.
expected_metadata_path = tmp_path / expected_metadata_name

# A file expect a sibling metadata path.
expected_metadata_path = tmp_path / expected_metadata_name

return (
unique_in_path,
Expand All @@ -404,9 +401,7 @@ def test_filter_folder_structure_info(
expected_metadata_path,
) = dataset_input_output

metadata_offset = expected_metadata_path.relative_to(
input_dataset_path if input_dataset_path.is_dir() else input_dataset_path.parent
)
metadata_offset = expected_metadata_path.relative_to(input_dataset_path.parent)

input_folder = tmp_path / "inputs"

Expand Down

0 comments on commit c187b77

Please sign in to comment.