Adjust tests for a last minute Python 3.11 change in the traceback format
This commit is contained in:
parent
8add1e4d09
commit
6f4d0d8cf4
63
10132.patch
Normal file
63
10132.patch
Normal file
@ -0,0 +1,63 @@
|
||||
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",
|
@ -2,12 +2,15 @@ Name: pytest
|
||||
%global base_version 7.1.2
|
||||
#global prerelease ...
|
||||
Version: %{base_version}%{?prerelease:~%{prerelease}}
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Simple powerful testing with Python
|
||||
License: MIT
|
||||
URL: https://pytest.org
|
||||
Source: %{pypi_source pytest %{base_version}%{?prerelease}}
|
||||
|
||||
# Adjust tests for a last minute Python 3.11 change in the traceback format
|
||||
Patch: https://github.com/pytest-dev/pytest/pull/10132.patch
|
||||
|
||||
# When building pytest for the first time with new Python version
|
||||
# we might not yet have all the BRs, those conditionals allow us to do that.
|
||||
|
||||
@ -156,6 +159,9 @@ find %{buildroot}%{python3_sitelib} \
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jul 13 2022 Miro Hrončok <mhroncok@redhat.com> - 7.1.2-4
|
||||
- Adjust tests for a last minute Python 3.11 change in the traceback format
|
||||
|
||||
* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 7.1.2-3
|
||||
- Rebuilt for Python 3.11
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user