bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035)

This commit is contained in:
Serhiy Storchaka 2020-06-25 17:56:31 +03:00 committed by GitHub
parent 8ea6353f60
commit 700cfa8c90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 110 additions and 77 deletions

View file

@ -41,8 +41,9 @@ class TestCgitb(unittest.TestCase):
rc, out, err = assert_python_failure(
'-c',
('import cgitb; cgitb.enable(logdir=%s); '
'raise ValueError("Hello World")') % repr(tracedir))
out = out.decode(sys.getfilesystemencoding())
'raise ValueError("Hello World")') % repr(tracedir),
PYTHONIOENCODING='utf-8')
out = out.decode()
self.assertIn("ValueError", out)
self.assertIn("Hello World", out)
self.assertIn("<strong>&lt;module&gt;</strong>", out)
@ -56,8 +57,9 @@ class TestCgitb(unittest.TestCase):
rc, out, err = assert_python_failure(
'-c',
('import cgitb; cgitb.enable(format="text", logdir=%s); '
'raise ValueError("Hello World")') % repr(tracedir))
out = out.decode(sys.getfilesystemencoding())
'raise ValueError("Hello World")') % repr(tracedir),
PYTHONIOENCODING='utf-8')
out = out.decode()
self.assertIn("ValueError", out)
self.assertIn("Hello World", out)
self.assertNotIn('<p>', out)