Skip to content

Commit 37a6d5f

Browse files
authored
[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
1 parent ab74c01 commit 37a6d5f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Lib/test/test_shutil.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,7 @@ def test_rmtree_errors(self):
280280
filename = os.path.join(tmpdir, "tstfile")
281281
with self.assertRaises(NotADirectoryError) as cm:
282282
shutil.rmtree(filename)
283-
# The reason for this rather odd construct is that Windows sprinkles
284-
# a \*.* at the end of file names. But only sometimes on some buildbots
285-
possible_args = [filename, os.path.join(filename, '*.*')]
286-
self.assertIn(cm.exception.filename, possible_args)
283+
self.assertEqual(cm.exception.filename, filename)
287284
self.assertTrue(os.path.exists(filename))
288285
# test that ignore_errors option is honored
289286
shutil.rmtree(filename, ignore_errors=True)
@@ -296,11 +293,11 @@ def onerror(*args):
296293
self.assertIs(errors[0][0], os.scandir)
297294
self.assertEqual(errors[0][1], filename)
298295
self.assertIsInstance(errors[0][2][1], NotADirectoryError)
299-
self.assertIn(errors[0][2][1].filename, possible_args)
296+
self.assertEqual(errors[0][2][1].filename, filename)
300297
self.assertIs(errors[1][0], os.rmdir)
301298
self.assertEqual(errors[1][1], filename)
302299
self.assertIsInstance(errors[1][2][1], NotADirectoryError)
303-
self.assertIn(errors[1][2][1].filename, possible_args)
300+
self.assertEqual(errors[1][2][1].filename, filename)
304301

305302

306303
@unittest.skipIf(sys.platform[:6] == 'cygwin',

0 commit comments

Comments
 (0)