changeset: 70926:da3af4b131d7 branch: 3.2 parent: 70923:8d46e84cd812 user: Victor Stinner date: Wed Jun 22 21:28:43 2011 +0200 files: Lib/test/test_subprocess.py description: 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. diff -r 8d46e84cd812 -r da3af4b131d7 Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py Tue Jun 21 21:59:06 2011 +0200 +++ b/Lib/test/test_subprocess.py Wed Jun 22 21:28:43 2011 +0200 @@ -339,7 +339,7 @@ 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): @@ -349,7 +349,11 @@ 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",