bpo-41113: Fix test_warnings on non-Western locales. (GH-21143)

This commit is contained in:
Serhiy Storchaka 2020-06-25 14:43:33 +03:00 committed by GitHub
parent aad8f0eeca
commit 0f8ec1fff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1198,13 +1198,13 @@ class EnvironmentVariableTests(BaseTest):
@unittest.skipUnless(sys.getfilesystemencoding() != 'ascii', @unittest.skipUnless(sys.getfilesystemencoding() != 'ascii',
'requires non-ascii filesystemencoding') 'requires non-ascii filesystemencoding')
def test_nonascii(self): def test_nonascii(self):
PYTHONWARNINGS="ignore:DeprecationWarning" + (support.FS_NONASCII or '')
rc, stdout, stderr = assert_python_ok("-c", rc, stdout, stderr = assert_python_ok("-c",
"import sys; sys.stdout.write(str(sys.warnoptions))", "import sys; sys.stdout.write(str(sys.warnoptions))",
PYTHONIOENCODING="utf-8", PYTHONIOENCODING="utf-8",
PYTHONWARNINGS="ignore:DeprecaciónWarning", PYTHONWARNINGS=PYTHONWARNINGS,
PYTHONDEVMODE="") PYTHONDEVMODE="")
self.assertEqual(stdout, self.assertEqual(stdout, str([PYTHONWARNINGS]).encode())
"['ignore:DeprecaciónWarning']".encode('utf-8'))
class CEnvironmentVariableTests(EnvironmentVariableTests, unittest.TestCase): class CEnvironmentVariableTests(EnvironmentVariableTests, unittest.TestCase):
module = c_warnings module = c_warnings