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

Method test_rmtree_errors_onerror

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

Source from the content-addressed store, hash-verified

342 shutil.rmtree(filename, dir_fd='invalid', ignore_errors=True)
343
344 def test_rmtree_errors_onerror(self):
345 tmpdir = self.mkdtemp()
346 filename = os.path.join(tmpdir, "tstfile")
347 create_file(filename)
348 errors = []
349 def onerror(*args):
350 errors.append(args)
351 shutil.rmtree(filename, onerror=onerror)
352 self.assertEqual(len(errors), 2)
353 self.assertIs(errors[0][0], os.scandir)
354 self.assertEqual(errors[0][1], filename)
355 self.assertIsInstance(errors[0][2][1], NotADirectoryError)
356 self.assertEqual(errors[0][2][1].filename, filename)
357 self.assertIs(errors[1][0], os.rmdir)
358 self.assertEqual(errors[1][1], filename)
359 self.assertIsInstance(errors[1][2][1], NotADirectoryError)
360 self.assertEqual(errors[1][2][1].filename, filename)
361
362 def test_rmtree_errors_onexc(self):
363 tmpdir = self.mkdtemp()

Callers

nothing calls this directly

Calls 6

mkdtempMethod · 0.80
assertIsInstanceMethod · 0.80
create_fileFunction · 0.70
joinMethod · 0.45
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected