diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 0d1f60a4f36..a4cf60fed4b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2112,7 +2112,7 @@ class OSErrorTests(unittest.TestCase): for name in self.filenames: try: func(name, *func_args) - except FileNotFoundError as err: + except OSError as err: self.assertIs(err.filename, name) else: self.fail("No exception thrown by {}".format(func))