Skip to content

Commit 12d9935

Browse files
Fix FileExistsError in unittest
1 parent 615914e commit 12d9935

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

client/configuration/tests/search_path_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def test_command_line_argument(self) -> None:
8585
"foo$bar",
8686
)
8787

88-
Path.mkdir(Path("foo"))
89-
Path.mkdir(Path("foo/bar-1.0.0.dist-info"))
90-
Path.touch(Path("foo/bar.py"))
88+
Path.mkdir(Path("foo"), exist_ok=True)
89+
Path.mkdir(Path("foo/bar-1.0.0.dist-info"), exist_ok=True)
90+
Path.touch(Path("foo/bar.py"), exist_ok=True)
9191

9292
with open("foo/bar-1.0.0.dist-info/RECORD", "w", encoding="UTF-8") as f:
9393
f.write("bar.py")
@@ -251,9 +251,9 @@ def test_process_required_raw_elements_site_package_nonexistence(self) -> None:
251251
)
252252

253253
def test_toplevel_module_not_pyfile(self):
254-
Path.mkdir(Path("foo"))
255-
Path.mkdir(Path("foo/bar-1.0.0.dist-info"))
256-
Path.touch(Path("foo/bar.so"))
254+
Path.mkdir(Path("foo"), exist_ok=True)
255+
Path.mkdir(Path("foo/bar-1.0.0.dist-info"), exist_ok=True)
256+
Path.touch(Path("foo/bar.so"), exist_ok=True)
257257

258258
with open("foo/bar-1.0.0.dist-info/RECORD", "w", encoding="UTF-8") as f:
259259
f.write("bar.so")

0 commit comments

Comments
 (0)