summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorHynek Schlawack <hs@ox.cx>2012-12-10 15:35:16 (GMT)
committerHynek Schlawack <hs@ox.cx>2012-12-10 15:35:16 (GMT)
commit6c722c6df464f327784e34191ea43d79d7e99f94 (patch)
treeb54113d871388dfe79b886a0b21406bf2bd156ab /Lib
parent99d28ce0cdd96bc421f57424b078ef296bf7dbcb (diff)
parentc474c4e7498e00249a85d973a608a86f4b56e7d5 (diff)
downloadcpython-6c722c6df464f327784e34191ea43d79d7e99f94.zip
cpython-6c722c6df464f327784e34191ea43d79d7e99f94.tar.gz
cpython-6c722c6df464f327784e34191ea43d79d7e99f94.tar.bz2
#15872: Some more Windows related tuning to shutil.rmtree tests
Turns out, the snakebite bots have also their peculiarities. I'm really not proud of this stream of commits. :(
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_shutil.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index a8951d3..ad62280 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -172,11 +172,10 @@ class TestShutil(unittest.TestCase):
filename = os.path.join(tmpdir, "tstfile")
with self.assertRaises(NotADirectoryError) as cm:
shutil.rmtree(filename)
- if cm.exception.filename.endswith('*.*'):
- rm_name = os.path.join(filename, '*.*')
- else:
- rm_name = filename
- self.assertEqual(cm.exception.filename, rm_name)
+ # 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.assertTrue(os.path.exists(filename))
# test that ignore_errors option is honored
shutil.rmtree(filename, ignore_errors=True)
@@ -189,11 +188,12 @@ class TestShutil(unittest.TestCase):
self.assertIs(errors[0][0], os.listdir)
self.assertEqual(errors[0][1], filename)
self.assertIsInstance(errors[0][2][1], NotADirectoryError)
- self.assertEqual(errors[0][2][1].filename, rm_name)
+ self.assertIn(errors[0][2][1].filename, possible_args)
self.assertIs(errors[1][0], os.rmdir)
self.assertEqual(errors[1][1], filename)
self.assertIsInstance(errors[1][2][1], NotADirectoryError)
- self.assertEqual(errors[1][2][1].filename, rm_name)
+ self.assertIn(errors[1][2][1].filename, possible_args)
+
# See bug #1071513 for why we don't run this on cygwin
# and bug #1076467 for why we don't run this as root.