MCPcopy Index your code
hub / github.com/python/cpython / test_rmtree_fails_on_junctions_onexc

Method test_rmtree_fails_on_junctions_onexc

Lib/test/test_shutil.py:276–293  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 11

mkdtempMethod · 0.80
addCleanupMethod · 0.80
assertTrueMethod · 0.80
assertIsInstanceMethod · 0.80
joinMethod · 0.45
mkdirMethod · 0.45
assertRaisesMethod · 0.45
existsMethod · 0.45
lexistsMethod · 0.45
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected