summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-08-24 23:05:51 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-08-24 23:05:51 (GMT)
commitebe53a23c9edc8f01fa261f9ea8e358b1ad481a2 (patch)
tree691137c8a8ca89a5e12c519490fc75be22da0eca
parent8515eaefda6348a72464805ff8d07041d16ab97d (diff)
downloadcpython-ebe53a23c9edc8f01fa261f9ea8e358b1ad481a2.zip
cpython-ebe53a23c9edc8f01fa261f9ea8e358b1ad481a2.tar.gz
cpython-ebe53a23c9edc8f01fa261f9ea8e358b1ad481a2.tar.bz2
Fix test_sys for FreeBSD, Solaris and Mac OS X
_Py_char2wchar() (mbctowcs) decodes b'\xff' to '\xff' on FreeBSD, Solaris and Mac OS X, even if the locale is C (and the locale encoding is ASCII). Patch test_undecodable_code() to support this output and document the two different kinds of outputs.
-rw-r--r--Lib/test/test_sys.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 294814d..dcd36be 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -511,10 +511,23 @@ class SysModuleTest(unittest.TestCase):
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
env=env)
stdout, stderr = p.communicate()
- pattern = b"Unable to decode the command from the command line:"
+ if p.returncode == 1:
+ # _Py_char2wchar() decoded b'\xff' as '\udcff' (b'\xff' is not
+ # decodable from ASCII) and run_command() failed on
+ # PyUnicode_AsUTF8String(). This is the expected behaviour on
+ # Linux.
+ pattern = b"Unable to decode the command from the command line:"
+ elif p.returncode == 0:
+ # _Py_char2wchar() decoded b'\xff' as '\xff' even if the locale is
+ # C and the locale encoding is ASCII. It occurs on FreeBSD, Solaris
+ # and Mac OS X.
+ pattern = b"'\\xff' "
+ # The output is followed by the encoding name, an alias to ASCII.
+ # Examples: "US-ASCII" or "646" (ISO 646, on Solaris).
+ else:
+ raise AssertionError("Unknown exit code: %s, output=%a" % (p.returncode, stdout))
if not stdout.startswith(pattern):
raise AssertionError("%a doesn't start with %a" % (stdout, pattern))
- self.assertEqual(p.returncode, 1)
def test_sys_flags(self):
self.assertTrue(sys.flags)
8cbef88f16bb32b92712d2d'>Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.Martin v. Löwis2003-03-291-0/+2 * Fix typo.Walter Dörwald2003-03-261-1/+1 * Frank Vercruesse gave an okay on removing the copyright notice:Jack Jansen2003-03-251-0/+1 * Added a Mac note that EasyDialogs dialogs now bring the application toJack Jansen2003-03-241-1/+3 * When Py_TRACE_REFS is defined, a list of all live objects is maintained inTim Peters2003-03-231-4/+13 * add several people involved with PEP 305 and the csv packageSkip Montanaro2003-03-201-0/+3 * announce csv packageSkip Montanaro2003-03-201-0/+2 * SF bug 705836: struct.pack of floats in non-native endian orderTim Peters2003-03-201-0/+8 * Fixed SF bug #663074. The codec system was using global staticGustavo Niemeyer2003-03-191-0/+5 * Renamed PyObject_GenericGetIter to PyObject_SelfIterRaymond Hettinger2003-03-171-1/+1 * Add Hye-Shik Chang for SF patch/bugreport #703471.Thomas Wouters2003-03-171-0/+1 * Created PyObject_GenericGetIter().Raymond Hettinger2003-03-171-0/+3 * - New function time.tzset() provides access to the C library tzet()Guido van Rossum2003-03-142-0/+4 * Take out my (long since disabled) POSIX signal mask handling code.Michael W. Hudson2003-03-131-3/+0 * Fix spelling.Raymond Hettinger2003-03-111-10/+10 * SF patch #667730: More DictMixinRaymond Hettinger2003-03-091-0/+1 * SF 698520: Iterator for urllib.URLOpenerRaymond Hettinger2003-03-091-0/+3 * - The extended type structure used for heap types (new-styleGuido van Rossum2003-03-071-1/+3 * SF patch #693753: fix for bug 639806: default for dict.popRaymond Hettinger2003-03-061-0/+6 * Mention timeit.py.Guido van Rossum2003-03-061-0/+3 * Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize,Martin v. Löwis2003-03-051-0/+2 * Fix SF #692416, don't crash interpreter for _tkinter.deletefilehandlerNeal Norwitz2003-03-031-0/+4 * Patch #683592 revisited, after discussions with MvL:Just van Rossum2003-03-031-7/+5 * py-pdbtrack-grub-for-buffer(): Rectified some logic errors iKen Manheimer2003-03-031-6/+18 * Fix bugMichael W. Hudson2003-03-031-0/+3 * Guard advancing past leading meta-comments.Ken Manheimer2003-03-031-4/+6 * Enhanced pdbtrack to provide for source code that's not findable byKen Manheimer2003-03-03