summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-06-11 22:17:52 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-06-11 22:17:52 (GMT)
commit2690461a9eeb34038e8a7a66617ef8d23195a15e (patch)
treeab4eaed8acfebee019b1f9bca7a2f726d649bcc9 /Lib/test/test_sys.py
parent9e19ca42d31ba9ff3bc3dc901d832877d3815adb (diff)
downloadcpython-2690461a9eeb34038e8a7a66617ef8d23195a15e.zip
cpython-2690461a9eeb34038e8a7a66617ef8d23195a15e.tar.gz
cpython-2690461a9eeb34038e8a7a66617ef8d23195a15e.tar.bz2
Issue #8965: Add a regression test to test_sys with LANG=C
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 3711804..8273a79 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -863,10 +863,21 @@ class SizeofTest(unittest.TestCase):
# sys.flags
check(sys.flags, size(vh) + self.P * len(sys.flags))
+ @unittest.skipUnless(sys.platform == 'darwin', "test specific to Mac OS X")
def test_getfilesystemencoding(self):
+ # On Darwing FS encoding is always UTF-8
fs_encoding = sys.getfilesystemencoding()
- if sys.platform == 'darwin':
- self.assertEqual(fs_encoding, '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.rstrip()
+ self.assertEqual(fs_encoding, b'utf-8')
def test_setfilesystemencoding(self):
old = sys.getfilesystemencoding()