Skip to content

Commit

Permalink
Items in root of pushed folder are not placed into a directory (#954)
Browse files Browse the repository at this point in the history
  • Loading branch information
JBWilkie authored Nov 14, 2024
1 parent d3749f8 commit f0ba378
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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

0 comments on commit f0ba378

Please sign in to comment.