(self)
| 294 | |
| 295 | @unittest.skipUnless(_winapi, 'only relevant on Windows') |
| 296 | def test_rmtree_works_on_junctions(self): |
| 297 | tmp = self.mkdtemp() |
| 298 | dir1 = os.path.join(tmp, 'dir1') |
| 299 | dir2 = os.path.join(dir1, 'dir2') |
| 300 | dir3 = os.path.join(tmp, 'dir3') |
| 301 | for d in dir1, dir2, dir3: |
| 302 | os.mkdir(d) |
| 303 | file1 = os.path.join(tmp, 'file1') |
| 304 | create_file(file1, 'foo') |
| 305 | link1 = os.path.join(dir1, 'link1') |
| 306 | _winapi.CreateJunction(dir2, link1) |
| 307 | link2 = os.path.join(dir1, 'link2') |
| 308 | _winapi.CreateJunction(dir3, link2) |
| 309 | link3 = os.path.join(dir1, 'link3') |
| 310 | _winapi.CreateJunction(file1, link3) |
| 311 | # make sure junctions are removed but not followed |
| 312 | shutil.rmtree(dir1) |
| 313 | self.assertFalse(os.path.exists(dir1)) |
| 314 | self.assertTrue(os.path.exists(dir3)) |
| 315 | self.assertTrue(os.path.exists(file1)) |
| 316 | |
| 317 | def test_rmtree_errors(self): |
| 318 | # filename is guaranteed not to exist |
nothing calls this directly
no test coverage detected