]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 10 Jul 2024 10:38:48 +0000 (12:38 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Jul 2024 10:38:48 +0000 (10:38 +0000)
gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572)
(cherry picked from commit e2822360da30853f092d8a50ad83e52f6ea2ced9)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/support/__init__.py
Lib/test/test_subprocess.py

index 81cd7f14d2ad1cb099e9b0a2ab4d6a60392dac39..38357cb792d7b229b067b791396941731e9c6a20 100644 (file)
@@ -388,7 +388,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,