#15872: Fix shutil.rmtree error tests for Windows

This commit is contained in:
Hynek Schlawack 2012-12-10 10:07:11 +01:00
parent d16eacba48
commit 9e8ac56e35
1 changed files with 5 additions and 1 deletions

View File

@ -132,7 +132,11 @@ class TestShutil(unittest.TestCase):
filename = os.path.join(tmpdir, "tstfile")
with self.assertRaises(OSError) as cm:
shutil.rmtree(filename)
self.assertEqual(cm.exception.filename, filename)
if os.name == 'nt':
rm_name = os.path.join(filename, '*.*')
else:
rm_name = filename
self.assertEqual(cm.exception.filename, rm_name)
self.assertTrue(os.path.exists(filename))
# test that ignore_errors option is honoured
shutil.rmtree(filename, ignore_errors=True)