File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -74,10 +74,10 @@ def get_dependency(
7474
7575
7676def 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 )
You can’t perform that action at this time.
0 commit comments