Skip to content

Commit b2e9b16

Browse files
committed
Keep drive-rooted clone tests on the current drive
1 parent 923e6a0 commit b2e9b16

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

test/test_repo.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,16 @@ def test_clone_from_keeps_env(self, rw_dir):
238238
@with_rw_directory
239239
def test_clone_from_drive_rooted_destination(self, rw_dir):
240240
original_repo = Repo.init(osp.join(rw_dir, "repo"))
241-
destination = osp.join(rw_dir, "clone")
242-
_drive, rooted_destination = osp.splitdrive(destination)
243241

244-
cloned = Repo.clone_from(original_repo.git_dir, rooted_destination)
242+
# Drive-rooted paths resolve on the current drive. Keep the destination
243+
# there even when the system temporary directory uses another drive.
244+
with tempfile.TemporaryDirectory(dir=os.getcwd()) as destination_root:
245+
destination = osp.join(destination_root, "clone")
246+
_drive, rooted_destination = osp.splitdrive(destination)
245247

246-
assert osp.samefile(cloned.working_tree_dir, destination)
248+
cloned = Repo.clone_from(original_repo.git_dir, rooted_destination)
249+
250+
assert osp.samefile(cloned.working_tree_dir, destination)
247251

248252
@with_rw_directory
249253
def test_date_format(self, rw_dir):

0 commit comments

Comments
 (0)