From e20f54f542195e053653b1902db7a4c1642f4589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Fri, 6 Feb 2009 10:17:34 +0000 Subject: [PATCH] Fix a number of Win32ErrorTests error cases. chmod wasn't being tested. 'access' never raises an error. --- Lib/test/test_os.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 4180d0600dc..64b29ead241 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -524,16 +524,18 @@ class Win32ErrorTests(unittest.TestCase): self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) def test_mkdir(self): - self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) + f = open(test_support.TESTFN, "w") + try: + self.assertRaises(WindowsError, os.mkdir, test_support.TESTFN) + finally: + f.close() + os.unlink(test_support.TESTFN) def test_utime(self): self.assertRaises(WindowsError, os.utime, test_support.TESTFN, None) - def test_access(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) - def test_chmod(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) + self.assertRaises(WindowsError, os.chmod, test_support.TESTFN, 0) class TestInvalidFD(unittest.TestCase): singles = ["fchdir", "fdopen", "dup", "fdatasync", "fstat",