(self)
| 129 | |
| 130 | class TestAvoidSymbolicLinks(unittest.TestCase): |
| 131 | def setUp(self): |
| 132 | with tempfile.TemporaryDirectory() as import_test_folder: |
| 133 | base_path = Path(import_test_folder) |
| 134 | (base_path / "Level0" / "Level1" / "Level2").mkdir(parents=True) |
| 135 | (base_path / "Left").mkdir(parents=True) |
| 136 | (base_path / "Right").mkdir(parents=True) |
| 137 | |
| 138 | current_path = base_path / "Level0" |
| 139 | (current_path / "__init__.py").touch() |
| 140 | |
| 141 | current_path = current_path / "Level1" |
| 142 | (current_path / "__init__.py").touch() |
| 143 | |
| 144 | current_path = current_path / "Level2" |
| 145 | (current_path / "__init__.py").touch() |
| 146 | # Level0/Level1/Level2/Level3 -> Level0/Level1 |
| 147 | (current_path / "Level3").symlink_to( |
| 148 | base_path / "Level0" / "Level1", target_is_directory=True |
| 149 | ) |
| 150 | |
| 151 | current_path = base_path / "Right" |
| 152 | (current_path / "__init__.py").touch() |
| 153 | # Right/toLeft -> Left |
| 154 | (current_path / "toLeft").symlink_to( |
| 155 | base_path / "Left", target_is_directory=True |
| 156 | ) |
| 157 | |
| 158 | current_path = base_path / "Left" |
| 159 | (current_path / "__init__.py").touch() |
| 160 | # Left/toRight -> Right |
| 161 | (current_path / "toRight").symlink_to( |
| 162 | base_path / "Right", target_is_directory=True |
| 163 | ) |
| 164 | |
| 165 | self.module_gatherer = ModuleGatherer((base_path.absolute(),)) |
| 166 | while self.module_gatherer.find_coroutine(): |
| 167 | pass |
| 168 | |
| 169 | def test_simple_symbolic_link_loop(self): |
| 170 | filepaths = [ |
nothing calls this directly
no test coverage detected