- update to 7.2.2:

* Fixed :func:`pytest.approx`
    handling of dictionaries containing one or more values of
    `0.0`.
  * Fixed crash if `--cache-show` and `--help` are passed at the
    same time.
  * Fixed bug where a fixture method named ``teardown`` would
    be called as part of ``nose`` teardown stage.
  * Fixed crash if ``--fixtures`` and ``--help`` are passed
    at the same time.
  * Fixed :py:func:`pytest.raises` to
    return a 'ContextManager' so that type-checkers could narrow
    :code:`pytest.raises(...) if ... else nullcontext()` down to
    'ContextManager' rather than 'object'.
  * Fix 'importlib.abc.TraversableResources' deprecation warning in
    Python 3.12.
  * If a test is skipped from inside a fixture, the test summary
    now shows the test location instead of the fixture location.
  * Fix a race condition when creating junitxml reports,
    which could occur when multiple instances of pytest execute
    in parallel.
  * Fix a race condition when
    creating or updating the stepwise plugin's cache, which could
    occur when multiple xdist worker nodes try to simultaneously
    update the stepwise plugin's cache.
- drop fix-test-raising-repr.patch, fix-tests-pygments-2.14.0.patch: 
  merged upstream

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest?expand=0&rev=113
This commit is contained in:
Dirk Mueller 2023-05-04 23:06:15 +00:00 committed by Git OBS Bridge
parent f55bffb67f
commit 18316d2a99
6 changed files with 35 additions and 138 deletions

View File

@ -1,21 +0,0 @@
Index: pytest-7.2.0/testing/test_assertion.py
===================================================================
--- pytest-7.2.0.orig/testing/test_assertion.py
+++ pytest-7.2.0/testing/test_assertion.py
@@ -1664,15 +1664,7 @@ def test_raise_assertion_error_raising_r
"""
)
result = pytester.runpytest()
- 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>"]
- )
+ result.stdout.fnmatch_lines(["E AssertionError: <exception str() failed>"])
def test_issue_1944(pytester: Pytester) -> None:

View File

@ -1,109 +0,0 @@
From 61f70a5a759bd22457c89f3564c0cfbb91b0cd8d Mon Sep 17 00:00:00 2001
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
Date: Wed, 4 Jan 2023 09:29:53 +0100
Subject: [PATCH] Fix tests pygments 2.14.0
Fix https://github.com/pytest-dev/pytest/issues/10630
---
testing/conftest.py | 1 +
testing/io/test_terminalwriter.py | 2 +-
testing/test_terminal.py | 24 ++++++++++++------------
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/testing/conftest.py b/testing/conftest.py
index 107aad86b..8a9816799 100644
--- a/testing/conftest.py
+++ b/testing/conftest.py
@@ -157,6 +157,7 @@ def color_mapping():
"number": "\x1b[94m",
"str": "\x1b[33m",
"print": "\x1b[96m",
+ "endline": "\x1b[90m\x1b[39;49;00m",
}
RE_COLORS = {k: re.escape(v) for k, v in COLORS.items()}
diff --git a/testing/io/test_terminalwriter.py b/testing/io/test_terminalwriter.py
index 6fe718b53..b5a04a99f 100644
--- a/testing/io/test_terminalwriter.py
+++ b/testing/io/test_terminalwriter.py
@@ -254,7 +254,7 @@ class TestTerminalWriterLineWidth:
pytest.param(
True,
True,
- "{kw}assert{hl-reset} {number}0{hl-reset}\n",
+ "{kw}assert{hl-reset} {number}0{hl-reset}{endline}\n",
id="with markup and code_highlight",
),
pytest.param(
diff --git a/testing/test_terminal.py b/testing/test_terminal.py
index 9de9a85f0..453f18323 100644
--- a/testing/test_terminal.py
+++ b/testing/test_terminal.py
@@ -1265,14 +1265,14 @@ def test_color_yes(pytester: Pytester, color_mapping) -> None:
"=*= FAILURES =*=",
"{red}{bold}_*_ test_this _*_{reset}",
"",
- " {kw}def{hl-reset} {function}test_this{hl-reset}():",
- "> fail()",
+ " {kw}def{hl-reset} {function}test_this{hl-reset}():{endline}",
+ "> fail(){endline}",
"",
"{bold}{red}test_color_yes.py{reset}:5: ",
"_ _ * _ _*",
"",
- " {kw}def{hl-reset} {function}fail{hl-reset}():",
- "> {kw}assert{hl-reset} {number}0{hl-reset}",
+ " {kw}def{hl-reset} {function}fail{hl-reset}():{endline}",
+ "> {kw}assert{hl-reset} {number}0{hl-reset}{endline}",
"{bold}{red}E assert 0{reset}",
"",
"{bold}{red}test_color_yes.py{reset}:2: AssertionError",
@@ -1292,9 +1292,9 @@ def test_color_yes(pytester: Pytester, color_mapping) -> None:
"=*= FAILURES =*=",
"{red}{bold}_*_ test_this _*_{reset}",
"{bold}{red}test_color_yes.py{reset}:5: in test_this",
- " fail()",
+ " fail(){endline}",
"{bold}{red}test_color_yes.py{reset}:2: in fail",
- " {kw}assert{hl-reset} {number}0{hl-reset}",
+ " {kw}assert{hl-reset} {number}0{hl-reset}{endline}",
"{bold}{red}E assert 0{reset}",
"{red}=*= {red}{bold}1 failed{reset}{red} in *s{reset}{red} =*={reset}",
]
@@ -2472,8 +2472,8 @@ class TestCodeHighlight:
result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch(
[
- " {kw}def{hl-reset} {function}test_foo{hl-reset}():",
- "> {kw}assert{hl-reset} {number}1{hl-reset} == {number}10{hl-reset}",
+ " {kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
+ "> {kw}assert{hl-reset} {number}1{hl-reset} == {number}10{hl-reset}{endline}",
"{bold}{red}E assert 1 == 10{reset}",
]
)
@@ -2494,9 +2494,9 @@ class TestCodeHighlight:
result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch(
[
- " {kw}def{hl-reset} {function}test_foo{hl-reset}():",
+ " {kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
" {print}print{hl-reset}({str}'''{hl-reset}{str}{hl-reset}",
- "> {str} {hl-reset}{str}'''{hl-reset}); {kw}assert{hl-reset} {number}0{hl-reset}",
+ "> {str} {hl-reset}{str}'''{hl-reset}); {kw}assert{hl-reset} {number}0{hl-reset}{endline}",
"{bold}{red}E assert 0{reset}",
]
)
@@ -2517,8 +2517,8 @@ class TestCodeHighlight:
result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch(
[
- " {kw}def{hl-reset} {function}test_foo{hl-reset}():",
- "> {kw}assert{hl-reset} {number}1{hl-reset} == {number}10{hl-reset}",
+ " {kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
+ "> {kw}assert{hl-reset} {number}1{hl-reset} == {number}10{hl-reset}{endline}",
"{bold}{red}E assert 1 == 10{reset}",
]
)
--
2.39.0

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4014eb40e10f11f355ad4e3c2fb2c6c6d1919c73f3b5a433de4708202cade59
size 1300608

3
pytest-7.2.2.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4
size 1320028

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Thu May 4 23:01:07 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 7.2.2:
* Fixed :func:`pytest.approx`
handling of dictionaries containing one or more values of
`0.0`.
* Fixed crash if `--cache-show` and `--help` are passed at the
same time.
* Fixed bug where a fixture method named ``teardown`` would
be called as part of ``nose`` teardown stage.
* Fixed crash if ``--fixtures`` and ``--help`` are passed
at the same time.
* Fixed :py:func:`pytest.raises` to
return a 'ContextManager' so that type-checkers could narrow
:code:`pytest.raises(...) if ... else nullcontext()` down to
'ContextManager' rather than 'object'.
* Fix 'importlib.abc.TraversableResources' deprecation warning in
Python 3.12.
* If a test is skipped from inside a fixture, the test summary
now shows the test location instead of the fixture location.
* Fix a race condition when creating junitxml reports,
which could occur when multiple instances of pytest execute
in parallel.
* Fix a race condition when
creating or updating the stepwise plugin's cache, which could
occur when multiple xdist worker nodes try to simultaneously
update the stepwise plugin's cache.
- drop fix-test-raising-repr.patch, fix-tests-pygments-2.14.0.patch:
merged upstream
-------------------------------------------------------------------
Fri Apr 21 12:31:23 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -34,16 +34,12 @@
%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-pytest%{psuffix}
Version: 7.2.0
Version: 7.2.2
Release: 0
Summary: Simple powerful testing with Python
License: MIT
URL: https://github.com/pytest-dev/pytest
Source: https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz
# PATCH-FIX-UPSTREAM fix-test-raising-repr.patch gh#pytest-dev/pytest#10473
Patch: fix-test-raising-repr.patch
# PATCH-FIX-UPSTREAM fix-tests-pygments-2.14.0.patch gh#pytest-dev/pytest#10632
Patch1: fix-tests-pygments-2.14.0.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module setuptools_scm >= 6}
BuildRequires: %{python_module setuptools}