Commit 4ce881e9 authored by Victor Stinner's avatar Victor Stinner

Fix my test introduced in test_sys by r79394:

Restore the orginal filesystem encoding before testing
assertRaises(LookupError, sys.setfilesystemencoding, "xxx"). Unittest formats
the exception, but the formatting failed because the file system was invalid
(set to iso-8859-1 by the previous test).

Anyway, ensure to restore the original filesystem encoding when exiting
test_setfilesystemencoding() to avoid error propagation to the other tests.
parent e777a686
......@@ -797,9 +797,14 @@ class SizeofTest(unittest.TestCase):
def test_setfilesystemencoding(self):
old = sys.getfilesystemencoding()
try:
sys.setfilesystemencoding("iso-8859-1")
self.assertEqual(sys.getfilesystemencoding(), "iso-8859-1")
finally:
sys.setfilesystemencoding(old)
try:
self.assertRaises(LookupError, sys.setfilesystemencoding, "xxx")
finally:
sys.setfilesystemencoding(old)
def test_main():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment