pytest/10132.patch

64 lines
2.6 KiB
Diff
Raw Normal View History

From 09b2c9532090db84daa3aa1a243f90dc8709fc00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Wed, 13 Jul 2022 17:06:33 +0200
Subject: [PATCH] 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
---
testing/test_doctest.py | 6 +++++-
testing/test_main.py | 6 +++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/testing/test_doctest.py b/testing/test_doctest.py
index 828253d322..2f73feb8c4 100644
--- a/testing/test_doctest.py
+++ b/testing/test_doctest.py
@@ -223,7 +223,11 @@ def test_doctest_unexpected_exception(self, pytester: Pytester):
"Traceback (most recent call last):",
' 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>',
"ZeroDivisionError: division by zero",
"*/test_doctest_unexpected_exception.txt:2: UnexpectedException",
diff --git a/testing/test_main.py b/testing/test_main.py
index 2df51bb7bb..7159762679 100644
--- a/testing/test_main.py
+++ b/testing/test_main.py
@@ -47,7 +47,7 @@ def pytest_internalerror(excrepr, excinfo):
end_lines = (
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:]
)
@@ -57,7 +57,7 @@ def pytest_internalerror(excrepr, excinfo):
'INTERNALERROR> raise SystemExit("boom")',
*(
("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",)
- if sys.version_info >= (3, 11)
+ if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else ()
),
"INTERNALERROR> SystemExit: boom",
@@ -68,7 +68,7 @@ def pytest_internalerror(excrepr, excinfo):
'INTERNALERROR> raise ValueError("boom")',
*(
("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",)
- if sys.version_info >= (3, 11)
+ if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else ()
),
"INTERNALERROR> ValueError: boom",