(self)
| 274 | |
| 275 | @unittest.skipUnless(_winapi, 'only relevant on Windows') |
| 276 | def test_rmtree_fails_on_junctions_onexc(self): |
| 277 | tmp = self.mkdtemp() |
| 278 | dir_ = os.path.join(tmp, 'dir') |
| 279 | os.mkdir(dir_) |
| 280 | link = os.path.join(tmp, 'link') |
| 281 | _winapi.CreateJunction(dir_, link) |
| 282 | self.addCleanup(os_helper.unlink, link) |
| 283 | self.assertRaises(OSError, shutil.rmtree, link) |
| 284 | self.assertTrue(os.path.exists(dir_)) |
| 285 | self.assertTrue(os.path.lexists(link)) |
| 286 | errors = [] |
| 287 | def onexc(*args): |
| 288 | errors.append(args) |
| 289 | shutil.rmtree(link, onexc=onexc) |
| 290 | self.assertEqual(len(errors), 1) |
| 291 | self.assertIs(errors[0][0], os.path.islink) |
| 292 | self.assertEqual(errors[0][1], link) |
| 293 | self.assertIsInstance(errors[0][2], OSError) |
| 294 | |
| 295 | @unittest.skipUnless(_winapi, 'only relevant on Windows') |
| 296 | def test_rmtree_works_on_junctions(self): |
nothing calls this directly
no test coverage detected