summaryrefslogtreecommitdiff
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-22 21:29:07 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-22 21:29:07 +0200
commitc0a9f75fbae5b70fe98887d36a32229165f7d60a (patch)
tree503e4896b5ad9aa7e457c46935d5146638bcd80b /Lib/test/test_subprocess.py
parent749073af13fcb389059b182290f5cbc953222681 (diff)
parent237e5cb3767aece25e616fb41172836bb4f31760 (diff)
downloadcpython-git-c0a9f75fbae5b70fe98887d36a32229165f7d60a.tar.gz
(merge 3.2) 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.
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index cded232395..00bd579c54 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -390,7 +390,7 @@ class ProcessTestCase(BaseTestCase):
stdout, stderr = p.communicate()
self.assertEqual(stdout, b"orange")
- @unittest.skipIf(sysconfig.get_config_var('Py_ENABLE_SHARED') == 1,
+ @unittest.skipIf(sysconfig.get_config_var('Py_ENABLE_SHARED') is not None,
'the python library cannot be loaded '
'with an empty environment')
def test_empty_env(self):
@@ -400,7 +400,11 @@ class ProcessTestCase(BaseTestCase):
stdout=subprocess.PIPE,
env={}) as p:
stdout, stderr = p.communicate()
- self.assertEqual(stdout.strip(), b"[]")
+ self.assertIn(stdout.strip(),
+ (b"[]",
+ # Mac OS X adds __CF_USER_TEXT_ENCODING variable to an empty
+ # environment
+ b"['__CF_USER_TEXT_ENCODING']"))
def test_communicate_stdin(self):
p = subprocess.Popen([sys.executable, "-c",