Index: Lib/test/test_sys.py =================================================================== --- Lib/test/test_sys.py (revision 81886) +++ Lib/test/test_sys.py (working copy) @@ -865,8 +865,21 @@ def test_getfilesystemencoding(self): fs_encoding = sys.getfilesystemencoding() - if sys.platform == 'darwin': - self.assertEqual(fs_encoding, 'utf-8') + if sys.platform != 'darwin': + # XXX: can we meaninfully check the result + # on other platforms? + return + # On Darwing FS encoding is always UTF-8 + self.assertEqual(fs_encoding, 'utf-8') + # Even in C locale + env = os.environ.copy() + env['LANG'] = 'C' + output = subprocess.check_output( + [sys.executable, "-c", + "import sys; print(sys.getfilesystemencoding())"], + env=env) + fs_encoding = output.strip() + self.assertEqual(fs_encoding, b'utf-8') def test_setfilesystemencoding(self): old = sys.getfilesystemencoding()