#7301: decode $PYTHONWARNINGS in the same way as argv, test non-ascii values

This commit is contained in:
Philip Jenvey 2010-04-14 03:01:39 +00:00
parent 9b82f990cb
commit e53de3dc4a
4 changed files with 55 additions and 17 deletions

View file

@ -718,6 +718,19 @@ class EnvironmentVariableTests(BaseTest):
b"['ignore::UnicodeWarning', 'ignore::DeprecationWarning']")
self.assertEqual(p.wait(), 0)
@unittest.skipUnless(sys.getfilesystemencoding() != 'ascii',
'requires non-ascii filesystemencoding')
def test_nonascii(self):
newenv = os.environ.copy()
newenv["PYTHONWARNINGS"] = "ignore:DeprecaciónWarning"
newenv["PYTHONIOENCODING"] = "utf-8"
p = subprocess.Popen([sys.executable,
"-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
stdout=subprocess.PIPE, env=newenv)
self.assertEqual(p.communicate()[0],
"['ignore:DeprecaciónWarning']".encode('utf-8'))
self.assertEqual(p.wait(), 0)
class CEnvironmentVariableTests(EnvironmentVariableTests):
module = c_warnings