4 Commits

Author SHA256 Message Date
2b3af71a3e Accepting request 1193499 from devel:languages:python:pytest
- update to 8.3.2:
  * Resolve regression where `conda` environments where no longer
    being automatically detected

- Update to 8.3.1:
  * New features
    + Added `--xfail-tb` flag, which turns on traceback output for XFAIL
      results.
    + Added support for keyword matching in marker expressions.
    + Added ``--no-fold-skipped`` command line option.
  * Improvements
    + The console output now uses the "third-party plugins" terminology.
    + Python virtual environment detection was improved by checking for a
      pyvenv.cfg file
    + Do not truncate arguments to functions in output when running with -vvv.
    + The readability of assertion introspection of bound methods has been
      enhanced.
    + Added timezone information to the testsuite timestamp in the JUnit XML
      report.
  * Bug Fixes
    + Fixed reporting of teardown errors in higher-scoped fixtures when
      using `--maxfail` or `--stepwise`.
    + pytest.approx now correctly handles Sequence-like objects.
    + Fixed a regression in pytest 8.0 where tracebacks get longer and
      longer when multiple tests fail due to a shared higher-scope fixture
      which raised
    + Fixed collection error upon encountering an abstract class, including
      abstract unittest.TestCase subclasses.
    + Fixed a regression in pytest 8.0.0 where package-scoped parameterized
      items were not correctly reordered to minimize setups/teardowns in

OBS-URL: https://build.opensuse.org/request/show/1193499
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest?expand=0&rev=86
2024-08-17 10:40:58 +00:00
84f1f4c802 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest?expand=0&rev=142 2024-08-12 17:36:36 +00:00
80d78a5c7e - update to 8.3.2:
* Resolve regression where `conda` environments where no longer
    being automatically detected
  * Fix `PermissionError` crashes arising from directories which are not
  * Keyboard interrupts and system exits are now properly handled during
  * Fixed handling of 'Function not implemented' error under squashfuse_ll,
  * Fix a regression in pytest 8.2.0 where the permissions of
    automatically-created .pytest_cache directories became rwx------
  * Fix possible catastrophic performance slowdown on a certain
  * Fix a regression in pytest 8.2.0 where unittest class instances were
  * Fix possible “Directory not empty” crashes arising from concurent cache

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest?expand=0&rev=141
2024-08-12 17:36:27 +00:00
fd7477cb5b - Update to 8.3.1:
* New features
    + Added `--xfail-tb` flag, which turns on traceback output for XFAIL
      results.
    + Added support for keyword matching in marker expressions.
    + Added ``--no-fold-skipped`` command line option.
  * Improvements
    + The console output now uses the "third-party plugins" terminology.
    + Python virtual environment detection was improved by checking for a
      pyvenv.cfg file
    + Do not truncate arguments to functions in output when running with -vvv.
    + The readability of assertion introspection of bound methods has been
      enhanced.
    + Added timezone information to the testsuite timestamp in the JUnit XML
      report.
  * Bug Fixes
    + Fixed reporting of teardown errors in higher-scoped fixtures when
      using `--maxfail` or `--stepwise`.
    + pytest.approx now correctly handles Sequence-like objects.
    + Fixed a regression in pytest 8.0 where tracebacks get longer and
      longer when multiple tests fail due to a shared higher-scope fixture
      which raised
    + Fixed collection error upon encountering an abstract class, including
      abstract unittest.TestCase subclasses.
    + Fixed a regression in pytest 8.0.0 where package-scoped parameterized
      items were not correctly reordered to minimize setups/teardowns in
      some cases.
    + Fixed crash with `assert testcase is not None` assertion failure when
      re-running unittest tests using plugins like pytest-rerunfailures.
    + Fixed a crash when returning category ``"error"`` or ``"failed"`` with

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest?expand=0&rev=140
2024-07-23 04:34:32 +00:00
5 changed files with 64 additions and 125 deletions

View File

@@ -1,103 +0,0 @@
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

View File

@@ -1,3 +0,0 @@
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

View File

@@ -1,3 +1,52 @@
-------------------------------------------------------------------
Mon Aug 12 17:34:45 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 8.3.2:
* Resolve regression where `conda` environments where no longer
being automatically detected
-------------------------------------------------------------------
Tue Jul 23 04:34:06 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 8.3.1:
* New features
+ Added `--xfail-tb` flag, which turns on traceback output for XFAIL
results.
+ Added support for keyword matching in marker expressions.
+ Added ``--no-fold-skipped`` command line option.
* Improvements
+ The console output now uses the "third-party plugins" terminology.
+ Python virtual environment detection was improved by checking for a
pyvenv.cfg file
+ Do not truncate arguments to functions in output when running with -vvv.
+ The readability of assertion introspection of bound methods has been
enhanced.
+ Added timezone information to the testsuite timestamp in the JUnit XML
report.
* Bug Fixes
+ Fixed reporting of teardown errors in higher-scoped fixtures when
using `--maxfail` or `--stepwise`.
+ pytest.approx now correctly handles Sequence-like objects.
+ Fixed a regression in pytest 8.0 where tracebacks get longer and
longer when multiple tests fail due to a shared higher-scope fixture
which raised
+ Fixed collection error upon encountering an abstract class, including
abstract unittest.TestCase subclasses.
+ Fixed a regression in pytest 8.0.0 where package-scoped parameterized
items were not correctly reordered to minimize setups/teardowns in
some cases.
+ Fixed crash with `assert testcase is not None` assertion failure when
re-running unittest tests using plugins like pytest-rerunfailures.
+ Fixed a crash when returning category ``"error"`` or ``"failed"`` with
a custom test status from :hook:`pytest_report_teststatus` hook.
+ Improved handling of invalid regex patterns in
pytest.raises(match=r'...') by providing a clear error message.
+ Parametrization parameters are now compared using == instead of is
(is is still used as a fallback if the parameter does not support ==).
+ Fixed progress percentages sometimes not aligning correctly when
running with pytest-xdist -n.
- Drop patch allow-re-run-regression.patch: Included.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jun 11 03:03:23 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com> Tue Jun 11 03:03:23 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
@@ -9,20 +58,20 @@ Thu Jun 6 11:48:38 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Update to 8.2.2 - Update to 8.2.2
* Support for Python 3.13 (beta1 at the time of writing). * Support for Python 3.13 (beta1 at the time of writing).
* Fix `PermissionError` crashes arising from directories which are not * Fix `PermissionError` crashes arising from directories which are not
selected on the command-line. selected on the command-line.
* Keyboard interrupts and system exits are now properly handled during * Keyboard interrupts and system exits are now properly handled during
the test collection. the test collection.
* Fixed handling of 'Function not implemented' error under squashfuse_ll, * Fixed handling of 'Function not implemented' error under squashfuse_ll,
which is a different way to say that the mountpoint is read-only. which is a different way to say that the mountpoint is read-only.
* Fix a regression in pytest 8.2.0 where the permissions of * Fix a regression in pytest 8.2.0 where the permissions of
automatically-created .pytest_cache directories became rwx------ automatically-created .pytest_cache directories became rwx------
instead of the expected rwxr-xr-x. instead of the expected rwxr-xr-x.
* Fix possible catastrophic performance slowdown on a certain * Fix possible catastrophic performance slowdown on a certain
parametrization pattern involving many higher-scoped parameters. parametrization pattern involving many higher-scoped parameters.
* Fix a regression in pytest 8.2.0 where unittest class instances were * Fix a regression in pytest 8.2.0 where unittest class instances were
not released promptly on test teardown but only on session teardown. not released promptly on test teardown but only on session teardown.
* Fix possible “Directory not empty” crashes arising from concurent cache * Fix possible “Directory not empty” crashes arising from concurent cache
dir (.pytest_cache) creation. Regressed in pytest 8.2.0. dir (.pytest_cache) creation. Regressed in pytest 8.2.0.
------------------------------------------------------------------- -------------------------------------------------------------------

View File

@@ -33,15 +33,13 @@
%{?sle15_python_module_pythons} %{?sle15_python_module_pythons}
Name: python-pytest%{psuffix} Name: python-pytest%{psuffix}
Version: 8.2.2 Version: 8.3.2
Release: 0 Release: 0
Summary: Simple powerful testing with Python Summary: Simple powerful testing with Python
License: MIT License: MIT
URL: https://github.com/pytest-dev/pytest URL: https://github.com/pytest-dev/pytest
Source: https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz
# FIX-PATCH-UPSTREAM gh#pytest-dev/pytest#12438 BuildRequires: %{python_module base >= 3.8}
Patch0: allow-re-run-regression.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm >= 6} BuildRequires: %{python_module setuptools_scm >= 6}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
@@ -52,12 +50,12 @@ BuildRequires: python-rpm-macros >= 20210929
Requires: python-attrs >= 19.2.0 Requires: python-attrs >= 19.2.0
%if 0%{?python_version_nodots} < 311 %if 0%{?python_version_nodots} < 311
Requires: python-exceptiongroup >= 1.0.0 Requires: python-exceptiongroup >= 1.0.0
Requires: python-tomli >= 1
%endif %endif
Requires: python-iniconfig Requires: python-iniconfig
Requires: python-packaging Requires: python-packaging
Requires: python-pluggy >= 1.5 Requires: python-pluggy >= 1.5
Requires: python-setuptools Requires: python-setuptools
Requires: (python-tomli >= 1 if python-base < 3.11)
%if %{with libalternatives} %if %{with libalternatives}
Requires: alts Requires: alts
BuildRequires: alts BuildRequires: alts
@@ -73,11 +71,8 @@ BuildRequires: %{python_module Twisted}
BuildRequires: %{python_module attrs >= 19.2.0} BuildRequires: %{python_module attrs >= 19.2.0}
BuildRequires: %{python_module decorator} BuildRequires: %{python_module decorator}
BuildRequires: %{python_module hypothesis >= 3.56} BuildRequires: %{python_module hypothesis >= 3.56}
# nose is really not REQUIRED, the test suite skips over particular
# tests, when the package is not available.
# BuildRequires: %%{python_module nose}
BuildRequires: %{python_module pexpect}
BuildRequires: %{python_module numpy} BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pexpect}
BuildRequires: %{python_module pygments-pytest} BuildRequires: %{python_module pygments-pytest}
BuildRequires: %{python_module pytest >= %{version}} BuildRequires: %{python_module pytest >= %{version}}
BuildRequires: %{python_module pytest-xdist} BuildRequires: %{python_module pytest-xdist}
@@ -95,8 +90,6 @@ complex functional testing for applications and libraries.
%autosetup -p1 -n pytest-%{version} %autosetup -p1 -n pytest-%{version}
# fix gh#pytest-dev/pytest#7891 still happening for Leap # fix gh#pytest-dev/pytest#7891 still happening for Leap
sed -i '/^\[metadata\]/ a version = %{version}' setup.cfg sed -i '/^\[metadata\]/ a version = %{version}' setup.cfg
# Tests not failing with our current version of packages gh#pytest-dev/pytest#10042
sed -i '/pytest.mark.xfail(reason="#10042")/d' testing/test_debugging.py
%build %build
%pyproject_wheel %pyproject_wheel