diff options
author | Philip Jenvey <pjenvey@underboss.org> | 2010-04-10 20:27:15 (GMT) |
---|---|---|
committer | Philip Jenvey <pjenvey@underboss.org> | 2010-04-10 20:27:15 (GMT) |
commit | cdd98fb4634f6d3fc0815bfe490e1076e8b6ee9e (patch) | |
tree | 0d6ef2e5a7e942c10b17007547b687a1e20bdd45 /Lib/test/test_warnings.py | |
parent | b60ee469cd1cd9c51f319fc32fa37987581605d1 (diff) | |
download | cpython-cdd98fb4634f6d3fc0815bfe490e1076e8b6ee9e.zip cpython-cdd98fb4634f6d3fc0815bfe490e1076e8b6ee9e.tar.gz cpython-cdd98fb4634f6d3fc0815bfe490e1076e8b6ee9e.tar.bz2 |
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.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index e8df368..4e0afcc 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -683,7 +683,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(), "['ignore::DeprecationWarning']") + self.assertEqual(p.communicate()[0], "['ignore::DeprecationWarning']") + self.assertEqual(p.wait(), 0) def test_comma_separated_warnings(self): newenv = os.environ.copy() @@ -692,8 +693,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], "['ignore::DeprecationWarning', 'ignore::UnicodeWarning']") + self.assertEqual(p.wait(), 0) def test_envvar_and_command_line(self): newenv = os.environ.copy() @@ -701,8 +703,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], "['ignore::UnicodeWarning', 'ignore::DeprecationWarning']") + self.assertEqual(p.wait(), 0) class CEnvironmentVariableTests(EnvironmentVariableTests): module = c_warnings |