[Python-checkins] [WIP/RFC] bpo-15872: tests: remove oddity from test_rmtree_errors (GH-22967)

miss-islington webhook-mailer at python.org
Mon Dec 21 01:38:38 EST 2020


https://github.com/python/cpython/commit/37a6d5f8027f969418fe53d0a73a21003a8e370d
commit: 37a6d5f8027f969418fe53d0a73a21003a8e370d
branch: master
author: Daniel Hahler <git at thequod.de>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2020-12-20T22:38:02-08:00
summary:

[WIP/RFC] bpo-15872: tests: remove oddity from test_rmtree_errors (GH-22967)



This was added for (some) Windows buildbots back in 2012, and should
either not be necessary anymore, or it should probably get investigated
why "\*.*" gets added to filenames in the first place.

Ref:

Automerge-Triggered-By: GH:hynek

files:
M Lib/test/test_shutil.py

diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index df7fbedf24a7c..df8dcdcce6091 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -280,10 +280,7 @@ def test_rmtree_errors(self):
         filename = os.path.join(tmpdir, "tstfile")
         with self.assertRaises(NotADirectoryError) as cm:
             shutil.rmtree(filename)
-        # The reason for this rather odd construct is that Windows sprinkles
-        # a \*.* at the end of file names. But only sometimes on some buildbots
-        possible_args = [filename, os.path.join(filename, '*.*')]
-        self.assertIn(cm.exception.filename, possible_args)
+        self.assertEqual(cm.exception.filename, filename)
         self.assertTrue(os.path.exists(filename))
         # test that ignore_errors option is honored
         shutil.rmtree(filename, ignore_errors=True)
@@ -296,11 +293,11 @@ def onerror(*args):
         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)
+        self.assertEqual(errors[0][2][1].filename, filename)
         self.assertIs(errors[1][0], os.rmdir)
         self.assertEqual(errors[1][1], filename)
         self.assertIsInstance(errors[1][2][1], NotADirectoryError)
-        self.assertIn(errors[1][2][1].filename, possible_args)
+        self.assertEqual(errors[1][2][1].filename, filename)
 
 
     @unittest.skipIf(sys.platform[:6] == 'cygwin',



More information about the Python-checkins mailing list