- update to 8.3.4:

* #12592: Fixed :class:`KeyError` crash when using --import-
    mode=importlib in a directory layout where a directory
    contains a child directory with the same name.
  * #12818: Assertion rewriting now preserves the source ranges
    of the original instructions, making it play well with tools
    that deal with the AST, like executing.
  * #12849: ANSI escape codes for colored output now handled
    correctly in :func:`pytest.fail` with pytrace=False.
  * #9353: :func:`pytest.approx` now uses strict equality when
    given booleans.
  * #10558: Fix ambiguous docstring of
    :func:`pytest.Config.getoption`.
  * #10829: Improve documentation on the current handling of the
    --basetemp option and its lack of retention functionality
    (:ref:`temporary directory location and retention`).
  * #12866: Improved cross-references concerning the
    :fixture:`recwarn` fixture.
  * #12966: Clarify :ref:`filterwarnings` docs on filter
    precedence/order when using multiple
    :ref:`@pytest.mark.filterwarnings <pytest.mark.filterwarnings
    ref>` marks.
  * #12497: Fixed two failing pdb-related tests on Python 3.13.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest?expand=0&rev=146
This commit is contained in:
Dirk Mueller 2024-12-05 18:04:11 +00:00 committed by Git OBS Bridge
commit 626c961f3f
10 changed files with 3371 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -0,0 +1,103 @@
From 31791676501f8a8f9eb0d316a6d841a4c0d6738d Mon Sep 17 00:00:00 2001
From: Ran Benita <ran@unusedvar.com>
Date: Sat, 8 Jun 2024 02:11:20 +0300
Subject: [PATCH 1/2] [8.2.x] unittest: fix assertion errors on unittest reruns
---
changelog/12424.bugfix.rst | 1 +
src/_pytest/unittest.py | 2 +-
.../pytest_rerunfailures_integration.py | 11 +++++++++++
tox.ini | 2 +-
4 files changed, 14 insertions(+), 2 deletions(-)
create mode 100644 changelog/12424.bugfix.rst
create mode 100644 testing/plugins_integration/pytest_rerunfailures_integration.py
diff --git a/changelog/12424.bugfix.rst b/changelog/12424.bugfix.rst
new file mode 100644
index 00000000000..7ad1126858b
--- /dev/null
+++ b/changelog/12424.bugfix.rst
@@ -0,0 +1 @@
+Fix crash with `assert testcase is not None` assertion failure when re-running unittest tests using plugins like pytest-rerunfailures. Regressed in 8.2.2.
diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py
index baca58bd9b2..2f3fd5b014c 100644
--- a/src/_pytest/unittest.py
+++ b/src/_pytest/unittest.py
@@ -216,7 +216,7 @@ def teardown(self) -> None:
self._explicit_tearDown()
self._explicit_tearDown = None
self._obj = None
- self._instance = None
+ del self._instance
super().teardown()
def startTest(self, testcase: "unittest.TestCase") -> None:
diff --git a/testing/plugins_integration/pytest_rerunfailures_integration.py b/testing/plugins_integration/pytest_rerunfailures_integration.py
new file mode 100644
index 00000000000..9a13a3279a9
--- /dev/null
+++ b/testing/plugins_integration/pytest_rerunfailures_integration.py
@@ -0,0 +1,11 @@
+import unittest
+
+
+class MyTestCase(unittest.TestCase):
+ first_time = True
+
+ def test_fail_the_first_time(self) -> None:
+ """Regression test for issue #12424."""
+ if self.first_time:
+ type(self).first_time = False
+ self.fail()
diff --git a/tox.ini b/tox.ini
index 30d3e68defc..e42c2265525 100644
--- a/tox.ini
+++ b/tox.ini
@@ -143,7 +143,7 @@ commands =
pytest --cov=. simple_integration.py
pytest --ds=django_settings simple_integration.py
pytest --html=simple.html simple_integration.py
- pytest --reruns 5 simple_integration.py
+ pytest --reruns 5 simple_integration.py pytest_rerunfailures_integration.py
pytest pytest_anyio_integration.py
pytest pytest_asyncio_integration.py
pytest pytest_mock_integration.py
From 63136f2c483388bf268bafbd06eb7246ed5e9097 Mon Sep 17 00:00:00 2001
From: Bruno Oliveira <bruno@soliv.dev>
Date: Fri, 7 Jun 2024 22:17:58 -0300
Subject: [PATCH 2/2] Update testing/plugins_integration/requirements.txt from
main
This is required to make the 'plugins' tox env to pass on the 8.2.x branch.
---
testing/plugins_integration/requirements.txt | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt
index 9e152f1191b..f44a02915f2 100644
--- a/testing/plugins_integration/requirements.txt
+++ b/testing/plugins_integration/requirements.txt
@@ -1,9 +1,7 @@
-anyio[curio,trio]==4.3.0
-django==5.0.4
-pytest-asyncio==0.23.6
-# Temporarily not installed until pytest-bdd is fixed:
-# https://github.com/pytest-dev/pytest/pull/11785
-# pytest-bdd==7.0.1
+anyio[curio,trio]==4.4.0
+django==5.0.6
+pytest-asyncio==0.23.7
+pytest-bdd==7.1.2
pytest-cov==5.0.0
pytest-django==4.8.0
pytest-flakes==4.0.5
@@ -11,7 +9,7 @@ pytest-html==4.1.1
pytest-mock==3.14.0
pytest-rerunfailures==14.0
pytest-sugar==1.0.0
-pytest-trio==0.7.0
+pytest-trio==0.8.0
pytest-twisted==1.14.1
twisted==24.3.0
pytest-xvfb==3.0.0

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

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

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

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

BIN
pytest-8.3.3.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

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

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

3078
python-pytest.changes Normal file

File diff suppressed because it is too large Load Diff

151
python-pytest.spec Normal file
View File

@ -0,0 +1,151 @@
#
# spec file for package python-pytest
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -%{flavor}
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%{?sle15_python_module_pythons}
Name: python-pytest%{psuffix}
Version: 8.3.4
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
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm >= 6}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module tomli >= 1 if %python-base < 3.11}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros >= 20210929
Requires: python-attrs >= 19.2.0
%if 0%{?python_version_nodots} < 311
Requires: python-exceptiongroup >= 1.0.0
%endif
Requires: python-iniconfig
Requires: python-packaging
Requires: python-pluggy >= 1.5
Requires: python-setuptools
Requires: (python-tomli >= 1 if python-base < 3.11)
%if %{with libalternatives}
Requires: alts
BuildRequires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
Obsoletes: python-pytest-doc
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module Jinja2}
BuildRequires: %{python_module Twisted}
BuildRequires: %{python_module attrs >= 19.2.0}
BuildRequires: %{python_module decorator}
BuildRequires: %{python_module hypothesis >= 3.56}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pexpect}
BuildRequires: %{python_module pygments-pytest}
BuildRequires: %{python_module pytest >= %{version}}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module xmlschema}
BuildRequires: lsof
%endif
%python_subpackages
%description
The pytest framework makes it easy to write small tests, yet scales to support
complex functional testing for applications and libraries.
%prep
%autosetup -p1 -n pytest-%{version}
# fix gh#pytest-dev/pytest#7891 still happening for Leap
sed -i '/^\[metadata\]/ a version = %{version}' setup.cfg
%build
%pyproject_wheel
%install
%if ! %{with test}
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/pytest
%python_clone -a %{buildroot}%{_bindir}/py.test
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%check
%if %{with test}
# Don't run pexpect tests to avoid timeout error in OBS when running
# in quemu
%pytest -n auto -m "not uses_pexpect"
%endif
%if ! %{with test}
%pre
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative pytest
%post
%if ! %{with libalternatives}
# py.test was the master until Oct 2020. boo#1178547
alternatives=$(update-alternatives --quiet --list py.test 2> /dev/null) && (
update-alternatives --remove-all py.test
# reinstall group with new master for all existing flavors except ourself
for a in $alternatives; do
if [ $a != %{_bindir}/py.test-%{python_bin_suffix} ]; then
bin_suffix=${a##*-}
prio=${bin_suffix/./}
update-alternatives --quiet --install %{_bindir}/pytest pytest ${a/py.test/pytest} $prio \
--slave %{_bindir}/py.test py.test $a
fi
done
) ||:
%endif
%python_install_alternative pytest py.test
%postun
%python_uninstall_alternative pytest
%files %{python_files}
%doc AUTHORS CHANGELOG.rst README.rst
%license LICENSE
%python_alternative %{_bindir}/pytest
%python_alternative %{_bindir}/py.test
%pycache_only %{python_sitelib}/__pycache__/*.pyc
%{python_sitelib}/_pytest
%{python_sitelib}/py.py
%{python_sitelib}/pytest
%{python_sitelib}/pytest-%{version}.dist-info
%endif
%changelog