mirror of
https://github.com/python/cpython.git
synced 2025-11-26 13:22:51 +00:00
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 ........
This commit is contained in:
parent
75825a7a4c
commit
ad6139acc7
2 changed files with 23 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue