Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_subprocess.py @ 86212:fbbf8b160e8d
Issue #9548: Add a minimal "_bootlocale" module that is imported by the _io module instead of the full locale module.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sat, 12 Oct 2013 00:13:50 +0200 |
| parents | 1cbd3d9f7d61 |
| children | 05ce1bd1a4c2 |
line wrap: on
line diff
--- a/Lib/test/test_subprocess.py Fri Oct 11 21:40:55 2013 +0200 +++ b/Lib/test/test_subprocess.py Sat Oct 12 00:13:50 2013 +0200 @@ -883,8 +883,9 @@ # # UTF-16 and UTF-32-BE are sufficient to check both with BOM and # without, and UTF-16 and UTF-32. + import _bootlocale for encoding in ['utf-16', 'utf-32-be']: - old_getpreferredencoding = locale.getpreferredencoding + old_getpreferredencoding = _bootlocale.getpreferredencoding # Indirectly via io.TextIOWrapper, Popen() defaults to # locale.getpreferredencoding(False) and earlier in Python 3.2 to # locale.getpreferredencoding(). @@ -895,7 +896,7 @@ encoding) args = [sys.executable, '-c', code] try: - locale.getpreferredencoding = getpreferredencoding + _bootlocale.getpreferredencoding = getpreferredencoding # We set stdin to be non-None because, as of this writing, # a different code path is used when the number of pipes is # zero or one. @@ -904,7 +905,7 @@ stdout=subprocess.PIPE) stdout, stderr = popen.communicate(input='') finally: - locale.getpreferredencoding = old_getpreferredencoding + _bootlocale.getpreferredencoding = old_getpreferredencoding self.assertEqual(stdout, '1\n2\n3\n4') def test_no_leaking(self):
