mirror of https://github.com/python/cpython
[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
This commit is contained in:
parent
ab74c014ae
commit
37a6d5f802
|
@ -280,10 +280,7 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
|||
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 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
|||
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',
|
||||
|
|
Loading…
Reference in New Issue