bpo-28564: Use os.scandir() in shutil.rmtree(). (#4085)

This speeds up it to 20-40%.
This commit is contained in:
Serhiy Storchaka 2017-11-04 14:16:35 +02:00 committed by GitHub
parent 82cd3cede8
commit d4d79bc1ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 31 deletions

View file

@ -183,7 +183,7 @@ class TestShutil(unittest.TestCase):
errors.append(args)
shutil.rmtree(filename, onerror=onerror)
self.assertEqual(len(errors), 2)
self.assertIs(errors[0][0], os.listdir)
self.assertIs(errors[0][0], os.scandir)
self.assertEqual(errors[0][1], filename)
self.assertIsInstance(errors[0][2][1], NotADirectoryError)
self.assertIn(errors[0][2][1].filename, possible_args)