Adjust pytest's own tests for changes in Python 3.10.0b4
See https://github.com/pytest-dev/pytest/pull/8555#issuecomment-877881571 See https://mail.python.org/archives/list/python-dev@python.org/message/LSTMFAPSPD3BGZ4D6HQFODXZVB3PLYKF/
This commit is contained in:
parent
ec1d12b185
commit
cad86f7336
54
8555.patch
54
8555.patch
@ -31,60 +31,6 @@ index dd4be6c..6fc4184 100644
|
||||
markers = [
|
||||
|
||||
|
||||
From b4d2330fd4c8a9661d981f9a63b3d029bbf674d9 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Bruhin <me@the-compiler.org>
|
||||
Date: Wed, 14 Apr 2021 11:37:34 +0200
|
||||
Subject: [PATCH] Adjust enum reprs for Python 3.10
|
||||
|
||||
Potential fix for #8546
|
||||
---
|
||||
testing/python/metafunc.py | 5 ++++-
|
||||
testing/test_pytester.py | 14 ++++++++++----
|
||||
2 files changed, 14 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py
|
||||
index 676f1d9..21ab226 100644
|
||||
--- a/testing/python/metafunc.py
|
||||
+++ b/testing/python/metafunc.py
|
||||
@@ -448,7 +448,10 @@ class TestMetafunc:
|
||||
enum = pytest.importorskip("enum")
|
||||
e = enum.Enum("Foo", "one, two")
|
||||
result = idmaker(("a", "b"), [pytest.param(e.one, e.two)])
|
||||
- assert result == ["Foo.one-Foo.two"]
|
||||
+ if sys.version_info[:2] >= (3, 10):
|
||||
+ assert result == ["one-two"]
|
||||
+ else:
|
||||
+ assert result == ["Foo.one-Foo.two"]
|
||||
|
||||
def test_idmaker_idfn(self) -> None:
|
||||
"""#351"""
|
||||
diff --git a/testing/test_pytester.py b/testing/test_pytester.py
|
||||
index f2e8dd5..4234cdf 100644
|
||||
--- a/testing/test_pytester.py
|
||||
+++ b/testing/test_pytester.py
|
||||
@@ -741,10 +741,16 @@ def test_run_result_repr() -> None:
|
||||
|
||||
# known exit code
|
||||
r = pytester.RunResult(1, outlines, errlines, duration=0.5)
|
||||
- assert (
|
||||
- repr(r) == "<RunResult ret=ExitCode.TESTS_FAILED len(stdout.lines)=3"
|
||||
- " len(stderr.lines)=4 duration=0.50s>"
|
||||
- )
|
||||
+ if sys.version_info[:2] >= (3, 10):
|
||||
+ assert repr(r) == (
|
||||
+ "<RunResult ret=TESTS_FAILED len(stdout.lines)=3"
|
||||
+ " len(stderr.lines)=4 duration=0.50s>"
|
||||
+ )
|
||||
+ else:
|
||||
+ assert repr(r) == (
|
||||
+ "<RunResult ret=ExitCode.TESTS_FAILED len(stdout.lines)=3"
|
||||
+ " len(stderr.lines)=4 duration=0.50s>"
|
||||
+ )
|
||||
|
||||
# unknown exit code: just the number
|
||||
r = pytester.RunResult(99, outlines, errlines, duration=0.5)
|
||||
|
||||
|
||||
From 99dedde9c9e77e454e28f7811fcc27018d74686c Mon Sep 17 00:00:00 2001
|
||||
From: Florian Bruhin <me@the-compiler.org>
|
||||
Date: Tue, 4 May 2021 14:27:21 +0200
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: pytest
|
||||
Version: 6.2.4
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Simple powerful testing with Python
|
||||
License: MIT
|
||||
URL: https://pytest.org
|
||||
@ -13,7 +13,7 @@ Patch1: 8227.patch
|
||||
|
||||
# Fix Python 3.10 test issues
|
||||
# Merged upstream, https://github.com/pytest-dev/pytest/pull/8555
|
||||
# Rebased slightly
|
||||
# Rebased slightly, one commit removed after Python 3.10.0b4
|
||||
Patch2: 8555.patch
|
||||
|
||||
# Ignore DeprecationWarnings in test_trial_error
|
||||
@ -172,6 +172,9 @@ export INPUTRC=$PWD/.inputrc
|
||||
%{python3_sitelib}/pytest/
|
||||
|
||||
%changelog
|
||||
* Mon Jul 12 2021 Miro Hrončok <mhroncok@redhat.com> - 6.2.4-4
|
||||
- Adjust pytest's own tests for changes in Python 3.10.0b4
|
||||
|
||||
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 6.2.4-3
|
||||
- Rebuilt for Python 3.10
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user