Skip to content

Commit b879733

Browse files
committed
dest for git clone is a directory
1 parent aa86407 commit b879733

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/helpers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ def get_dependency(
7474

7575

7676
def copy_path(source: Path, dest: Path) -> None:
77-
if dest.is_symlink() or dest.is_file():
78-
dest.unlink() # missing_ok is only available in Python >= 3.8
79-
elif dest.is_dir():
77+
if dest.is_dir():
8078
shutil.rmtree(dest)
79+
else:
80+
dest.unlink(missing_ok=True)
8181

8282
if source.is_dir():
8383
shutil.copytree(source, dest)
@@ -106,12 +106,13 @@ def mock_clone(
106106

107107
assert parsed.resource is not None
108108
folder = FIXTURE_PATH / "git" / parsed.resource / path
109+
assert folder.is_dir()
109110

110111
if not source_root:
111112
source_root = Path(Config.create().get("cache-dir")) / "src"
112113

113114
dest = source_root / path
114-
dest.parent.mkdir(parents=True, exist_ok=True)
115+
dest.mkdir(parents=True, exist_ok=True)
115116

116117
copy_path(folder, dest)
117118
return MockDulwichRepo(dest)

0 commit comments

Comments
 (0)