summaryrefslogtreecommitdiff
path: root/Lib/test/test_warnings.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-04-11 21:16:33 +0000
committerBenjamin Peterson <benjamin@python.org>2010-04-11 21:16:33 +0000
commitad6139acc79271fd954d1f138235584a7d66c119 (patch)
treeb3efbb621ab9ef45093788700cecc9cd73c9ad83 /Lib/test/test_warnings.py
parent75825a7a4c69e9fd609055ae2658de1660f21798 (diff)
downloadcpython-git-ad6139acc79271fd954d1f138235584a7d66c119.tar.gz
Merged revisions 79936 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79936 | philip.jenvey | 2010-04-10 15:27:15 -0500 (Sat, 10 Apr 2010) | 3 lines fix PYTHONWARNINGS handling to not modify the original env value and improve its tests ........
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r--Lib/test/test_warnings.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index fa83fca42a..ca733f7e3b 100644
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -694,7 +694,8 @@ class EnvironmentVariableTests(BaseTest):
p = subprocess.Popen([sys.executable,
"-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
stdout=subprocess.PIPE, env=newenv)
- self.assertEqual(p.stdout.read(), b"['ignore::DeprecationWarning']")
+ self.assertEqual(p.communicate()[0], b"['ignore::DeprecationWarning']")
+ self.assertEqual(p.wait(), 0)
def test_comma_separated_warnings(self):
newenv = os.environ.copy()
@@ -703,8 +704,9 @@ class EnvironmentVariableTests(BaseTest):
p = subprocess.Popen([sys.executable,
"-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
stdout=subprocess.PIPE, env=newenv)
- self.assertEqual(p.stdout.read(),
+ self.assertEqual(p.communicate()[0],
b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']")
+ self.assertEqual(p.wait(), 0)
def test_envvar_and_command_line(self):
newenv = os.environ.copy()
@@ -712,8 +714,9 @@ class EnvironmentVariableTests(BaseTest):
p = subprocess.Popen([sys.executable, "-W" "ignore::UnicodeWarning",
"-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
stdout=subprocess.PIPE, env=newenv)
- self.assertEqual(p.stdout.read(),
+ self.assertEqual(p.communicate()[0],
b"['ignore::UnicodeWarning', 'ignore::DeprecationWarning']")
+ self.assertEqual(p.wait(), 0)
class CEnvironmentVariableTests(EnvironmentVariableTests):
module = c_warnings