Commits

Victor Stinner  committed 8d46e84

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.

  • Participants
  • Parent commits b5963fc
  • Branches 3.2

Comments (0)

Files changed (1)

File Lib/test/test_subprocess.py

             stdout, stderr = p.communicate()
             self.assertEqual(stdout, b"orange")
 
+    @unittest.skipIf(sysconfig.get_config_var('Py_ENABLE_SHARED') == 1,
+                     'the python library cannot be loaded '
+                     'with an empty environment')
     def test_empty_env(self):
         with subprocess.Popen([sys.executable, "-c",
                                'import os; '
-                               'print(len(os.environ))'],
+                               'print(list(os.environ.keys()))'],
                               stdout=subprocess.PIPE,
                               env={}) as p:
             stdout, stderr = p.communicate()
-            self.assertEqual(stdout.strip(), b"0")
+            self.assertEqual(stdout.strip(), b"[]")
 
     def test_communicate_stdin(self):
         p = subprocess.Popen([sys.executable, "-c",