Skip to content

Commit

Permalink
python 3.11 fixes: native support for un-stringable exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile authored and nicoddemus committed Feb 11, 2022
1 parent 43d54c8 commit 286a2bc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions testing/test_assertion.py
Expand Up @@ -1648,7 +1648,7 @@ def test_raise_assertion_error():
)


def test_raise_assertion_error_raisin_repr(pytester: Pytester) -> None:
def test_raise_assertion_error_raising_repr(pytester: Pytester) -> None:
pytester.makepyfile(
"""
class RaisingRepr(object):
Expand All @@ -1659,9 +1659,15 @@ def test_raising_repr():
"""
)
result = pytester.runpytest()
result.stdout.fnmatch_lines(
["E AssertionError: <unprintable AssertionError object>"]
)
if sys.version_info >= (3, 11):
# python 3.11 has native support for un-str-able exceptions
result.stdout.fnmatch_lines(
["E AssertionError: <exception str() failed>"]
)
else:
result.stdout.fnmatch_lines(
["E AssertionError: <unprintable AssertionError object>"]
)


def test_issue_1944(pytester: Pytester) -> None:
Expand Down

0 comments on commit 286a2bc

Please sign in to comment.