|
3 | 3 | # This source code is licensed under the MIT license found in the |
4 | 4 | # LICENSE file in the root directory of this source tree. |
5 | 5 |
|
6 | | -import shutil |
7 | 6 | import tempfile |
8 | 7 | from pathlib import Path |
9 | 8 | from typing import Iterable, Tuple |
@@ -577,22 +576,20 @@ def test_get_source_path__confliciting_source_specified(self) -> None: |
577 | 576 | ) |
578 | 577 |
|
579 | 578 | 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")) |
582 | 582 |
|
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") |
586 | 586 |
|
587 | | - try: |
588 | 587 | self.assertCountEqual( |
589 | 588 | SimpleSourcePath( |
590 | 589 | [element0, element1, element2, element0] |
591 | 590 | ).get_checked_directory_allowlist(), |
592 | 591 | [element0.path(), element1.path(), element2.path()], |
593 | 592 | ) |
594 | | - finally: |
595 | | - shutil.rmtree("super") |
596 | 593 |
|
597 | 594 | def test_get_checked_directory_for_buck_source_path(self) -> None: |
598 | 595 | self.assertCountEqual( |
|
0 commit comments