Adjust tests for a last minute Python 3.11 change in the traceback format

See https://github.com/python/cpython/issues/93883
and https://github.com/python/cpython/pull/93994

Fixes https://github.com/pytest-dev/pytest/issues/10131
This commit is contained in:
Miro Hrončok 2022-07-13 17:06:33 +02:00
parent c2b1d5b368
commit 09b2c95320
2 changed files with 8 additions and 4 deletions

View File

@ -223,7 +223,11 @@ class TestDoctests:
"Traceback (most recent call last):", "Traceback (most recent call last):",
' File "*/doctest.py", line *, in __run', ' File "*/doctest.py", line *, in __run',
" *", " *",
*((" *^^^^*",) if sys.version_info >= (3, 11) else ()), *(
(" *^^^^*",)
if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else ()
),
' File "<doctest test_doctest_unexpected_exception.txt[1]>", line 1, in <module>', ' File "<doctest test_doctest_unexpected_exception.txt[1]>", line 1, in <module>',
"ZeroDivisionError: division by zero", "ZeroDivisionError: division by zero",
"*/test_doctest_unexpected_exception.txt:2: UnexpectedException", "*/test_doctest_unexpected_exception.txt:2: UnexpectedException",

View File

@ -47,7 +47,7 @@ def test_wrap_session_notify_exception(ret_exc, pytester: Pytester) -> None:
end_lines = ( end_lines = (
result.stdout.lines[-4:] result.stdout.lines[-4:]
if sys.version_info >= (3, 11) if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else result.stdout.lines[-3:] else result.stdout.lines[-3:]
) )
@ -57,7 +57,7 @@ def test_wrap_session_notify_exception(ret_exc, pytester: Pytester) -> None:
'INTERNALERROR> raise SystemExit("boom")', 'INTERNALERROR> raise SystemExit("boom")',
*( *(
("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",) ("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",)
if sys.version_info >= (3, 11) if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else () else ()
), ),
"INTERNALERROR> SystemExit: boom", "INTERNALERROR> SystemExit: boom",
@ -68,7 +68,7 @@ def test_wrap_session_notify_exception(ret_exc, pytester: Pytester) -> None:
'INTERNALERROR> raise ValueError("boom")', 'INTERNALERROR> raise ValueError("boom")',
*( *(
("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",) ("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",)
if sys.version_info >= (3, 11) if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else () else ()
), ),
"INTERNALERROR> ValueError: boom", "INTERNALERROR> ValueError: boom",