From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:38:48 +0000 (+0200) Subject: [3.13] gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead ... X-Git-Tag: v3.13.0b4~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ced3fe87b06d943b351b811bee80318c907a081f;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572) (#121574) gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572) (cherry picked from commit e2822360da30853f092d8a50ad83e52f6ea2ced9) Co-authored-by: sobolevn --- diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 81cd7f14d2ad..38357cb792d7 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -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) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 8b69cd03ba7f..9412a2d737bb 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -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,