[Python-checkins] [3.12] gh-105436: Ignore unrelated errors when checking empty env (GH-105742) (#105756)

zooba webhook-mailer at python.org
Tue Jun 13 19:41:13 EDT 2023


https://github.com/python/cpython/commit/75239d5ec1505b8f9f20d3c2d366c1a3ebd269aa
commit: 75239d5ec1505b8f9f20d3c2d366c1a3ebd269aa
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: zooba <steve.dower at microsoft.com>
date: 2023-06-13T23:41:07Z
summary:

[3.12] gh-105436: Ignore unrelated errors when checking empty env (GH-105742) (#105756)

gh-105436: Ignore unrelated errors when checking empty env (GH-105742)
(cherry picked from commit 4cefe3cf10f498c0927ae4fdba4880d5a64826e4)

Co-authored-by: Steve Dower <steve.dower at python.org>

files:
M Lib/test/test_subprocess.py

diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 3d4fffbb8e79..817eab0c8a7e 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -1695,9 +1695,10 @@ def test_run_with_pathlike_path_and_arguments(self):
     @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;"



More information about the Python-checkins mailing list