(self)
| 254 | |
| 255 | @unittest.skipUnless(_winapi, 'only relevant on Windows') |
| 256 | def test_rmtree_fails_on_junctions_onerror(self): |
| 257 | tmp = self.mkdtemp() |
| 258 | dir_ = os.path.join(tmp, 'dir') |
| 259 | os.mkdir(dir_) |
| 260 | link = os.path.join(tmp, 'link') |
| 261 | _winapi.CreateJunction(dir_, link) |
| 262 | self.addCleanup(os_helper.unlink, link) |
| 263 | self.assertRaises(OSError, shutil.rmtree, link) |
| 264 | self.assertTrue(os.path.exists(dir_)) |
| 265 | self.assertTrue(os.path.lexists(link)) |
| 266 | errors = [] |
| 267 | def onerror(*args): |
| 268 | errors.append(args) |
| 269 | shutil.rmtree(link, onerror=onerror) |
| 270 | self.assertEqual(len(errors), 1) |
| 271 | self.assertIs(errors[0][0], os.path.islink) |
| 272 | self.assertEqual(errors[0][1], link) |
| 273 | self.assertIsInstance(errors[0][2][1], OSError) |
| 274 | |
| 275 | @unittest.skipUnless(_winapi, 'only relevant on Windows') |
| 276 | def test_rmtree_fails_on_junctions_onexc(self): |
nothing calls this directly
no test coverage detected