]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (#121572)
authorsobolevn <mail@sobolevn.me>
Wed, 10 Jul 2024 10:11:46 +0000 (13:11 +0300)
committerGitHub <noreply@github.com>
Wed, 10 Jul 2024 10:11:46 +0000 (13:11 +0300)
Lib/test/support/__init__.py
Lib/test/test_subprocess.py

index 18455bb6e0ff52bf20172e6e3f408f787985c001..7f6579319589b4a14ac134933931eac5d8ae18e7 100644 (file)
@@ -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)
index 8b69cd03ba7f2496cd77515d23d233855997d5f0..9412a2d737bb2e58ddefa7a45713afac093f3af5 100644 (file)
@@ -1407,7 +1407,7 @@ class ProcessTestCase(BaseTestCase):
         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,