summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-13 22:02:27 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-13 22:02:27 (GMT)
commit8f6b6b0cc3febd15e33a96bd31dcb3cbef2ad1ac (patch)
tree53db405b86756f9164c15497b8696a959f30ccbb /Lib
parentaa96592a59e1a79246283cddf026a72c9a16d11b (diff)
downloadcpython-8f6b6b0cc3febd15e33a96bd31dcb3cbef2ad1ac.zip
cpython-8f6b6b0cc3febd15e33a96bd31dcb3cbef2ad1ac.tar.gz
cpython-8f6b6b0cc3febd15e33a96bd31dcb3cbef2ad1ac.tar.bz2
Issue #9992: Remove PYTHONFSENCODING environment variable.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_os.py30
-rw-r--r--Lib/test/test_subprocess.py4
-rw-r--r--Lib/test/test_sys.py29
3 files changed, 0 insertions, 63 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 342dada..768814c 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1172,36 +1172,6 @@ class FSEncodingTests(unittest.TestCase):
continue
self.assertEquals(os.fsdecode(bytesfn), fn)
- def get_output(self, fs_encoding, func):
- env = os.environ.copy()
- env['PYTHONIOENCODING'] = 'utf-8'
- env['PYTHONFSENCODING'] = fs_encoding
- code = 'import os; print(%s, end="")' % func
- process = subprocess.Popen(
- [sys.executable, "-c", code],
- stdout=subprocess.PIPE, env=env)
- stdout, stderr = process.communicate()
- self.assertEqual(process.returncode, 0)
- return stdout.decode('utf-8')
-
- @unittest.skipIf(sys.platform in ('win32', 'darwin'),
- 'PYTHONFSENCODING is ignored on Windows and Mac OS X')
- def test_encodings(self):
- def check(encoding, bytesfn, unicodefn):
- encoded = self.get_output(encoding, 'repr(os.fsencode(%a))' % unicodefn)
- self.assertEqual(encoded, repr(bytesfn))
-
- decoded = self.get_output(encoding, 'repr(os.fsdecode(%a))' % bytesfn)
- self.assertEqual(decoded, repr(unicodefn))
-
- check('utf-8', b'\xc3\xa9\x80', '\xe9\udc80')
-
- # Raise SkipTest() if sys.executable is not encodable to ascii
- support.workaroundIssue8611()
-
- check('ascii', b'abc\xff', 'abc\udcff')
- check('iso-8859-15', b'\xef\xa4', '\xef\u20ac')
-
class PidTests(unittest.TestCase):
@unittest.skipUnless(hasattr(os, 'getppid'), "test needs os.getppid")
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index fef0ed8..6eff9e2 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -885,10 +885,6 @@ class POSIXProcessTestCase(BaseTestCase):
script = "import os; print(ascii(os.getenv(%s)))" % repr(key)
env = os.environ.copy()
env[key] = value
- # Force surrogate-escaping of \xFF in the child process;
- # otherwise it can be decoded as-is if the default locale
- # is latin-1.
- env['PYTHONFSENCODING'] = 'ascii'
stdout = subprocess.check_output(
[sys.executable, "-c", script],
env=env)
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 639c9b0..6e8aa25 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -602,35 +602,6 @@ class SysModuleTest(unittest.TestCase):
expected = None
self.check_fsencoding(fs_encoding, expected)
- @unittest.skipIf(sys.platform in ('win32', 'darwin'),
- 'PYTHONFSENCODING is ignored on Windows and Mac OS X')
- def test_pythonfsencoding(self):
- def get_fsencoding(env):
- output = subprocess.check_output(
- [sys.executable, "-c",
- "import sys; print(sys.getfilesystemencoding())"],
- env=env)
- return output.rstrip().decode('ascii')
-
- # Raise SkipTest() if sys.executable is not encodable to ascii
- test.support.workaroundIssue8611()
-
- # Use C locale to get ascii for the locale encoding
- env = os.environ.copy()
- env['LC_ALL'] = 'C'
- try:
- del env['PYTHONFSENCODING']
- except KeyError:
- pass
- self.check_fsencoding(get_fsencoding(env), 'ascii')
-
- # Filesystem encoding is hardcoded on Windows and Mac OS X
- for encoding in ('ascii', 'cp850', 'iso8859-1', 'utf-8'):
- env = os.environ.copy()
- env['PYTHONFSENCODING'] = encoding
- self.check_fsencoding(get_fsencoding(env), encoding)
-
-
class SizeofTest(unittest.TestCase):