Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 237e5cb

Browse files
author
Victor Stinner
committed
Issue #12383: fix test_empty_env() of subprocess on Mac OS X
Mac OS X adds __CF_USER_TEXT_ENCODING variable to an empty environment. Fix also the test on the Py_ENABLE_SHARED config varible: test that the variable is present, don't check it's value.
1 parent 372309a commit 237e5cb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/test/test_subprocess.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def test_env(self):
339339
stdout, stderr = p.communicate()
340340
self.assertEqual(stdout, b"orange")
341341

342-
@unittest.skipIf(sysconfig.get_config_var('Py_ENABLE_SHARED') == 1,
342+
@unittest.skipIf(sysconfig.get_config_var('Py_ENABLE_SHARED') is not None,
343343
'the python library cannot be loaded '
344344
'with an empty environment')
345345
def test_empty_env(self):
@@ -349,7 +349,11 @@ def test_empty_env(self):
349349
stdout=subprocess.PIPE,
350350
env={}) as p:
351351
stdout, stderr = p.communicate()
352-
self.assertEqual(stdout.strip(), b"[]")
352+
self.assertIn(stdout.strip(),
353+
(b"[]",
354+
# Mac OS X adds __CF_USER_TEXT_ENCODING variable to an empty
355+
# environment
356+
b"['__CF_USER_TEXT_ENCODING']"))
353357

354358
def test_communicate_stdin(self):
355359
p = subprocess.Popen([sys.executable, "-c",

0 commit comments

Comments
 (0)