From: Hynek Schlawack Date: Mon, 10 Dec 2012 09:08:41 +0000 (+0100) Subject: #15872: Fix shutil.rmtree error tests for Windows X-Git-Tag: v3.3.1rc1~544 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b57b09407767d340c655cb12acd4cc0a561cab0f;p=thirdparty%2FPython%2Fcpython.git #15872: Fix shutil.rmtree error tests for Windows --- b57b09407767d340c655cb12acd4cc0a561cab0f diff --cc Lib/test/test_shutil.py index 149e4c34f7db,9dab5f510d41..f352ef138a70 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@@ -167,13 -128,17 +167,17 @@@ class TestShutil(unittest.TestCase) # existing file tmpdir = self.mkdtemp() - self.write_file((tmpdir, "tstfile"), "") + write_file((tmpdir, "tstfile"), "") filename = os.path.join(tmpdir, "tstfile") - with self.assertRaises(OSError) as cm: + with self.assertRaises(NotADirectoryError) 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 + # test that ignore_errors option is honored shutil.rmtree(filename, ignore_errors=True) self.assertTrue(os.path.exists(filename)) errors = []