]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #12383: skip test_empty_env() if compiled is compiled in shared mode
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 21 Jun 2011 19:59:06 +0000 (21:59 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 21 Jun 2011 19:59:06 +0000 (21:59 +0200)
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.

Lib/test/test_subprocess.py

index 3ee2e6edf20299a635de314e5b62967b18a3e0ae..8444d6a5170f53a6cbeb7a2cf8fd6a1cf3a82e85 100644 (file)
@@ -339,14 +339,17 @@ class ProcessTestCase(BaseTestCase):
             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",