https://github.com/python/cpython/commit/e2822360da30853f092d8a50ad83e52f6ea2ced9
commit: e2822360da30853f092d8a50ad83e52f6ea2ced9
branch: main
author: sobolevn <[email protected]>
committer: sobolevn <[email protected]>
date: 2024-07-10T13:11:46+03:00
summary:

gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead 
(#121572)

files:
M Lib/test/support/__init__.py
M Lib/test/test_subprocess.py

diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 18455bb6e0ff52..7f6579319589b4 100644
--- a/Lib/test/support/__init__.py
+++ b/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 a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 8b69cd03ba7f24..9412a2d737bb2e 100644
--- a/Lib/test/test_subprocess.py
+++ b/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,

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to