From 1f9a0f0e0fe25f5e17cffb04a404b2bd0deeca7e Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Fri, 29 Nov 2019 12:38:12 -0600 Subject: [PATCH] address @efiop's suggestions --- dvc/remote/s3.py | 4 ++-- tests/unit/remote/test_s3.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dvc/remote/s3.py b/dvc/remote/s3.py index 75084ad51..8013f9bb9 100644 --- a/dvc/remote/s3.py +++ b/dvc/remote/s3.py @@ -213,11 +213,11 @@ class RemoteS3(RemoteBASE): return path_info.path == fname or fname.startswith(dir_path.path) def makedirs(self, path_info): - # We need to support creating empty directories, on S3, that means + # We need to support creating empty directories, which means # creating an object with an empty body and a trailing slash `/`. # # We are not creating directory objects for every parent prefix, - # it doesn't make sense. + # as it is not required. dir_path = path_info / "" self.s3.put_object(Bucket=path_info.bucket, Key=dir_path.path, Body="") diff --git a/tests/unit/remote/test_s3.py b/tests/unit/remote/test_s3.py index 96b729917..49fc3dbb8 100644 --- a/tests/unit/remote/test_s3.py +++ b/tests/unit/remote/test_s3.py @@ -103,8 +103,8 @@ def test_copy_preserve_etag_across_buckets(remote): assert from_etag == to_etag -def makedirs(remote): - empty_dir = remote.path_info / "empty_dir" +def test_makedirs(remote): + empty_dir = remote.path_info / "empty_dir" / "" remote.remove(empty_dir) assert not remote.exists(empty_dir) remote.makedirs(empty_dir)