Closed
Description
Bug report
Since 3.3 EnvironmentError
is just an alias for OSError
. There are several places where it is still used. I propose to modernize the code. Just like we did with IOError
.
diff --git Lib/test/support/__init__.py Lib/test/support/__init__.py
index 18455bb6e0f..7f657931958 100644
--- Lib/test/support/__init__.py
+++ Lib/test/support/__init__.py
@@ -387,7 +387,7 @@ def skip_if_buildbot(reason=None):
reason = 'not suitable for buildbots'
try:
isbuildbot = getpass.getuser().lower() == 'buildbot'
- except (KeyError, EnvironmentError) as err:
+ except (KeyError, OSError) as err:
warnings.warn(f'getpass.getuser() failed {err}.', RuntimeWarning)
isbuildbot = False
return unittest.skipIf(isbuildbot, reason)
diff --git Lib/test/test_subprocess.py Lib/test/test_subprocess.py
index 8b69cd03ba7..9412a2d737b 100644
--- Lib/test/test_subprocess.py
+++ Lib/test/test_subprocess.py
@@ -1407,7 +1407,7 @@ def open_fds():
t = threading.Thread(target=open_fds)
t.start()
try:
- with self.assertRaises(EnvironmentError):
+ with self.assertRaises(OSError):
subprocess.Popen(NONEXISTING_CMD,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,