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

Skip to content

Commit 372309a

Browse files
author
Victor Stinner
committed
Issue #12383: skip test_empty_env() if compiled is compiled in shared mode
Try also to get more informations about the Mac OS X failure: display the keys of the environment, instead of just the number of variables.
1 parent f1512a2 commit 372309a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Lib/test/test_subprocess.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,17 @@ 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,
343+
'the python library cannot be loaded '
344+
'with an empty environment')
342345
def test_empty_env(self):
343346
with subprocess.Popen([sys.executable, "-c",
344347
'import os; '
345-
'print(len(os.environ))'],
348+
'print(list(os.environ.keys()))'],
346349
stdout=subprocess.PIPE,
347350
env={}) as p:
348351
stdout, stderr = p.communicate()
349-
self.assertEqual(stdout.strip(), b"0")
352+
self.assertEqual(stdout.strip(), b"[]")
350353

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

0 commit comments

Comments
 (0)