]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-105436: Ignore unrelated errors when checking empty env (GH-105742) (#105756)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 13 Jun 2023 23:41:07 +0000 (16:41 -0700)
committerGitHub <noreply@github.com>
Tue, 13 Jun 2023 23:41:07 +0000 (23:41 +0000)
gh-105436: Ignore unrelated errors when checking empty env (GH-105742)
(cherry picked from commit 4cefe3cf10f498c0927ae4fdba4880d5a64826e4)

Co-authored-by: Steve Dower <steve.dower@python.org>
Lib/test/test_subprocess.py

index 3d4fffbb8e794ac17362a7018272ada69b6fc6cd..817eab0c8a7e19ddc3f3b5bd4bb647658caf3525 100644 (file)
@@ -1695,9 +1695,10 @@ class RunFuncTestCase(BaseTestCase):
     @unittest.skipUnless(mswindows, "Maybe test trigger a leak on Ubuntu")
     def test_run_with_an_empty_env(self):
         # gh-105436: fix subprocess.run(..., env={}) broken on Windows
-        args = [sys.executable, "-c", 'import sys; sys.exit(57)']
-        res = subprocess.run(args, env={})
-        self.assertEqual(res.returncode, 57)
+        args = [sys.executable, "-c", 'pass']
+        # Ignore subprocess errors - we only care that the API doesn't
+        # raise an OSError
+        subprocess.run(args, env={})
 
     def test_capture_output(self):
         cp = self.run_python(("import sys;"