From e4c9ac04f48d99f51347dc8a83446771d50dc23c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 14 Aug 2020 13:51:36 -0700 Subject: [PATCH] Not checking UnicodeDecodeError message because it differs between CPython and PyPy. Checking is too much trouble for very little gain. CPython: 'utf8' codec can't decode byte 0x80 in position 0: invalid start byte PyPy: 'utf8' codec can't decode byte 0x80 in position 0: invalid utf-8 --- tests/test_pytypes.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test_pytypes.py b/tests/test_pytypes.py index 75874272104..a66cb6af65e 100644 --- a/tests/test_pytypes.py +++ b/tests/test_pytypes.py @@ -262,9 +262,8 @@ def test_pybind11_str_raw_str(): malformed_utf8 = b'\x80' if pytest.PY2: - with pytest.raises(UnicodeDecodeError) as excinfo: + with pytest.raises(UnicodeDecodeError): cvt(malformed_utf8) - assert "invalid start byte" in str(excinfo) else: malformed_cvt = cvt(malformed_utf8) assert type(malformed_cvt) is unicode if pytest.PY2 else str # noqa: F821 @@ -420,6 +419,5 @@ def test_pass_bytes_or_unicode_to_string_types(): assert m.pass_to_std_string(u"Str") == 3 malformed_utf8 = b"\x80" - with pytest.raises(UnicodeDecodeError) as excinfo: + with pytest.raises(UnicodeDecodeError): m.pass_to_pybind11_str(malformed_utf8) - assert 'invalid start byte' in str(excinfo.value)