Skip to content

Commit 179192e

Browse files
Fix unittest
1 parent 4cafef7 commit 179192e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

client/configuration/tests/search_path_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ def test_toplevel_module_not_pyfile(self) -> None:
276276
f.write("bar.so,,")
277277

278278
self.assertEqual(
279-
SitePackageElement(f"{temp_root}/foo", "bar", True).path(), "foo/bar.so"
279+
SitePackageElement(f"{temp_root}/foo", "bar", True).path(),
280+
f"{temp_root}/foo/bar.so",
280281
)
281282
self.assertEqual(
282283
process_raw_elements(

client/tests/backend_arguments_test.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
import shutil
76
import tempfile
87
from pathlib import Path
98
from typing import Iterable, Tuple
@@ -577,22 +576,20 @@ def test_get_source_path__confliciting_source_specified(self) -> None:
577576
)
578577

579578
def test_get_checked_directory_for_simple_source_path(self) -> None:
580-
Path.mkdir(Path("super"))
581-
Path.mkdir(Path("super/slash"))
579+
with tempfile.TemporaryDirectory() as temp_root:
580+
Path.mkdir(Path(f"{temp_root}/super"))
581+
Path.mkdir(Path(f"{temp_root}/super/slash"))
582582

583-
element0 = search_path.SimpleElement("ozzie")
584-
element1 = search_path.SubdirectoryElement("diva", "flea")
585-
element2 = search_path.SitePackageElement("super", "slash")
583+
element0 = search_path.SimpleElement("ozzie")
584+
element1 = search_path.SubdirectoryElement("diva", "flea")
585+
element2 = search_path.SitePackageElement(f"{temp_root}/super", "slash")
586586

587-
try:
588587
self.assertCountEqual(
589588
SimpleSourcePath(
590589
[element0, element1, element2, element0]
591590
).get_checked_directory_allowlist(),
592591
[element0.path(), element1.path(), element2.path()],
593592
)
594-
finally:
595-
shutil.rmtree("super")
596593

597594
def test_get_checked_directory_for_buck_source_path(self) -> None:
598595
self.assertCountEqual(

0 commit comments

Comments
 (0)