Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DAR-4137][External] Do not push files in root of pushed directories to a . directory when preserve_folders=True #954

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions darwin/dataset/remote_dataset_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,8 @@ def _find_files_to_upload_as_single_file_items(
local_path = str(
found_file.relative_to(source_files[0]).parent.as_posix()
)
if local_path == ".":
local_path = "/"
uploading_files.append(
LocalFile(
found_file,
Expand Down
19 changes: 19 additions & 0 deletions tests/darwin/dataset/remote_dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from darwin.dataset.release import Release, ReleaseStatus
from darwin.dataset.remote_dataset_v2 import (
RemoteDatasetV2,
_find_files_to_upload_as_single_file_items,
_find_files_to_upload_as_multi_file_items,
)
from darwin.dataset.upload_manager import (
Expand Down Expand Up @@ -846,6 +847,24 @@ def test_raises_if_incompatible_args_with_item_merge_mode(
**args, # type: ignore
)

@pytest.mark.usefixtures("setup_zip")
def test_files_in_root_push_directoies_are_given_correct_remote_path(
self, setup_zip
):
directory = setup_zip / "push_test_dir" / "topdir" / "subdir_1"
local_files = _find_files_to_upload_as_single_file_items(
[directory],
[],
[],
path="",
fps=1,
as_frames=False,
extract_views=False,
preserve_folders=True,
)
assert local_files[0].data["path"] == "/"
assert local_files[1].data["path"] == "/"


@pytest.mark.usefixtures("setup_zip")
class TestPushMultiSlotItem:
Expand Down