[Python-checkins] cpython (merge 3.2 -> default): (merge 3.2) Issue #12383: skip test_empty_env() if compiled is compiled in

victor.stinner python-checkins at python.org
Tue Jun 21 22:00:03 CEST 2011


http://hg.python.org/cpython/rev/d1d5a7392e39
changeset:   70924:d1d5a7392e39
parent:      70922:10ecf8576eb2
parent:      70923:8d46e84cd812
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Tue Jun 21 21:59:51 2011 +0200
summary:
  (merge 3.2) 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.

files:
  Lib/test/test_subprocess.py |  7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -390,14 +390,17 @@
             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",

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list