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

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

Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
Miss Islington (bot) 2023-06-13 16:39:56 -07:00 committed by GitHub
parent 2b1745f37c
commit c2e51a9985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -1693,9 +1693,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;"