Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pytest-rerunfailures for
openSUSE:Factory checked in at 2023-07-26 13:21:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-rerunfailures (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-rerunfailures.new.15225
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-rerunfailures"
Wed Jul 26 13:21:43 2023 rev:10 rq:1100456 version:12.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-rerunfailures/python-pytest-rerunfailures.changes
2023-05-10 16:17:28.662603178 +0200
+++
/work/SRC/openSUSE:Factory/.python-pytest-rerunfailures.new.15225/python-pytest-rerunfailures.changes
2023-07-26 13:21:51.607284824 +0200
@@ -1,0 +2,17 @@
+Mon Jul 24 19:55:40 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 12.0:
+ * Drop support for pytest < 6.2.
+ * Add ``only_rerun`` and ``rerun_except`` arguments to
+ ``@pytest.mark.flaky`` marker.
+ * Add support for pytest 7.3, 7.4.
+ * Failures are now rerun only if they match at least one
+ ``--only-rerun`` pattern (if given) and none of the
+ ``--rerun-except`` patterns. Previously, using both
+ ``--only-rerun`` and ``--rerun-except`` together
+ could cause failures to be rerun even if they did not
+ match any ``--only-rerun`` pattern, and when using
+ multiple ``--rerun-except`` patterns, all failures
+ would be rerun unless they matched every pattern.
+
+-------------------------------------------------------------------
Old:
----
pytest-rerunfailures-11.1.2.tar.gz
New:
----
pytest-rerunfailures-12.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-rerunfailures.spec ++++++
--- /var/tmp/diff_new_pack.Up8DI5/_old 2023-07-26 13:21:52.247288446 +0200
+++ /var/tmp/diff_new_pack.Up8DI5/_new 2023-07-26 13:21:52.251288469 +0200
@@ -16,11 +16,9 @@
#
-%{?!python_module:%define python_module() python3-%{**}}
-%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-pytest-rerunfailures
-Version: 11.1.2
+Version: 12.0
Release: 0
Summary: A pytest plugin to re-run tests
License: MPL-2.0
@@ -30,7 +28,7 @@
BuildRequires: %{python_module setuptools >= 40.0}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-pytest >= 6.0
+Requires: python-pytest >= 6.2
Requires: python-setuptools >= 40.0
BuildArch: noarch
# SECTION test requirements
++++++ pytest-rerunfailures-11.1.2.tar.gz -> pytest-rerunfailures-12.0.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-rerunfailures-11.1.2/CHANGES.rst
new/pytest-rerunfailures-12.0/CHANGES.rst
--- old/pytest-rerunfailures-11.1.2/CHANGES.rst 2023-03-09 08:17:56.000000000
+0100
+++ new/pytest-rerunfailures-12.0/CHANGES.rst 2023-07-05 07:53:41.000000000
+0200
@@ -1,20 +1,54 @@
Changelog
=========
+12.0 (2023-07-05)
+-----------------
+
+Breaking changes
+++++++++++++++++
+
+- Drop support for pytest < 6.2.
+
+Features
+++++++++
+
+- Add ``only_rerun`` and ``rerun_except`` arguments to ``@pytest.mark.flaky``
marker.
+
+- Add support for pytest 7.3, 7.4.
+
+Bug fixes
++++++++++
+
+- Failures are now rerun only if they match at least one ``--only-rerun``
+ pattern (if given) and none of the ``--rerun-except`` patterns. Previously,
+ using both ``--only-rerun`` and ``--rerun-except`` together could cause
+ failures to be rerun even if they did not match any ``--only-rerun``
+ pattern, and when using multiple ``--rerun-except`` patterns, all failures
+ would be rerun unless they matched every pattern.
+ (`#225 <https://github.com/pytest-dev/pytest-rerunfailures/issues/225>`_)
+
+
11.1.2 (2023-03-09)
-------------------
+Bug fixes
++++++++++
+
- Execute teardown when test was skipped in setup phase of a fixture.
11.1.1 (2023-02-17)
-------------------
+Bug fixes
++++++++++
+
- Fix crash during teardown when runtest protocol hook is overwritten by
another plugin.
- Fix crash during teardown when TestCase class is used as base class.
+
11.1 (2023-02-09)
-----------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-rerunfailures-11.1.2/PKG-INFO
new/pytest-rerunfailures-12.0/PKG-INFO
--- old/pytest-rerunfailures-11.1.2/PKG-INFO 2023-03-09 08:17:57.545184100
+0100
+++ new/pytest-rerunfailures-12.0/PKG-INFO 2023-07-05 07:53:42.352835200
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-rerunfailures
-Version: 11.1.2
+Version: 12.0
Summary: pytest plugin to re-run tests to eliminate flaky failures
Home-page: https://github.com/pytest-dev/pytest-rerunfailures
Author: Leah Klearman
@@ -140,6 +140,13 @@
$ pytest --reruns 5 --rerun-except AssertionError --rerun-except OSError
+.. note::
+
+ When the ```AssertionError``` comes from the use of the ``assert`` keyword,
+ use ``--rerun-except assert`` instead::
+
+ $ pytest --reruns 5 --rerun-except assert
+
Re-run individual failures
--------------------------
@@ -175,6 +182,27 @@
import random
assert random.choice([True, False])
+Exception filtering can be accomplished by specifying regular expressions for
+``only_rerun`` and ``rerun_except``. They override the ``--only-rerun`` and
+``--rerun-except`` command line arguments, respectively.
+
+Arguments can be a single string:
+
+.. code-block:: python
+
+ @pytest.mark.flaky(rerun_except="AssertionError")
+ def test_example():
+ raise AssertionError()
+
+Or a list of strings:
+
+.. code-block:: python
+
+ @pytest.mark.flaky(only_rerun=["AssertionError", "ValueError"])
+ def test_example():
+ raise AssertionError()
+
+
You can use ``@pytest.mark.flaky(condition)`` similarly as
``@pytest.mark.skipif(condition)``, see `pytest-mark-skipif
<https://docs.pytest.org/en/6.2.x/reference.html#pytest-mark-skipif>`_
.. code-block:: python
@@ -223,6 +251,9 @@
* This plugin may *not* be used with class, module, and package level fixtures.
* This plugin is *not* compatible with pytest-xdist's --looponfail flag.
* This plugin is *not* compatible with the core --pdb flag.
+* This plugin is *not* compatible with the plugin
+ `flaky <https://pypi.org/project/flaky/>`_, you can only have
+ ``pytest-rerunfailures`` or ``flaky`` but not both.
Resources
---------
@@ -245,20 +276,54 @@
Changelog
=========
+12.0 (2023-07-05)
+-----------------
+
+Breaking changes
+++++++++++++++++
+
+- Drop support for pytest < 6.2.
+
+Features
+++++++++
+
+- Add ``only_rerun`` and ``rerun_except`` arguments to ``@pytest.mark.flaky``
marker.
+
+- Add support for pytest 7.3, 7.4.
+
+Bug fixes
++++++++++
+
+- Failures are now rerun only if they match at least one ``--only-rerun``
+ pattern (if given) and none of the ``--rerun-except`` patterns. Previously,
+ using both ``--only-rerun`` and ``--rerun-except`` together could cause
+ failures to be rerun even if they did not match any ``--only-rerun``
+ pattern, and when using multiple ``--rerun-except`` patterns, all failures
+ would be rerun unless they matched every pattern.
+ (`#225 <https://github.com/pytest-dev/pytest-rerunfailures/issues/225>`_)
+
+
11.1.2 (2023-03-09)
-------------------
+Bug fixes
++++++++++
+
- Execute teardown when test was skipped in setup phase of a fixture.
11.1.1 (2023-02-17)
-------------------
+Bug fixes
++++++++++
+
- Fix crash during teardown when runtest protocol hook is overwritten by
another plugin.
- Fix crash during teardown when TestCase class is used as base class.
+
11.1 (2023-02-09)
-----------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-rerunfailures-11.1.2/README.rst
new/pytest-rerunfailures-12.0/README.rst
--- old/pytest-rerunfailures-11.1.2/README.rst 2023-03-09 08:17:56.000000000
+0100
+++ new/pytest-rerunfailures-12.0/README.rst 2023-07-05 07:53:41.000000000
+0200
@@ -107,6 +107,13 @@
$ pytest --reruns 5 --rerun-except AssertionError --rerun-except OSError
+.. note::
+
+ When the ```AssertionError``` comes from the use of the ``assert`` keyword,
+ use ``--rerun-except assert`` instead::
+
+ $ pytest --reruns 5 --rerun-except assert
+
Re-run individual failures
--------------------------
@@ -142,6 +149,27 @@
import random
assert random.choice([True, False])
+Exception filtering can be accomplished by specifying regular expressions for
+``only_rerun`` and ``rerun_except``. They override the ``--only-rerun`` and
+``--rerun-except`` command line arguments, respectively.
+
+Arguments can be a single string:
+
+.. code-block:: python
+
+ @pytest.mark.flaky(rerun_except="AssertionError")
+ def test_example():
+ raise AssertionError()
+
+Or a list of strings:
+
+.. code-block:: python
+
+ @pytest.mark.flaky(only_rerun=["AssertionError", "ValueError"])
+ def test_example():
+ raise AssertionError()
+
+
You can use ``@pytest.mark.flaky(condition)`` similarly as
``@pytest.mark.skipif(condition)``, see `pytest-mark-skipif
<https://docs.pytest.org/en/6.2.x/reference.html#pytest-mark-skipif>`_
.. code-block:: python
@@ -190,6 +218,9 @@
* This plugin may *not* be used with class, module, and package level fixtures.
* This plugin is *not* compatible with pytest-xdist's --looponfail flag.
* This plugin is *not* compatible with the core --pdb flag.
+* This plugin is *not* compatible with the plugin
+ `flaky <https://pypi.org/project/flaky/>`_, you can only have
+ ``pytest-rerunfailures`` or ``flaky`` but not both.
Resources
---------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-rerunfailures-11.1.2/pytest_rerunfailures.egg-info/PKG-INFO
new/pytest-rerunfailures-12.0/pytest_rerunfailures.egg-info/PKG-INFO
--- old/pytest-rerunfailures-11.1.2/pytest_rerunfailures.egg-info/PKG-INFO
2023-03-09 08:17:57.000000000 +0100
+++ new/pytest-rerunfailures-12.0/pytest_rerunfailures.egg-info/PKG-INFO
2023-07-05 07:53:42.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-rerunfailures
-Version: 11.1.2
+Version: 12.0
Summary: pytest plugin to re-run tests to eliminate flaky failures
Home-page: https://github.com/pytest-dev/pytest-rerunfailures
Author: Leah Klearman
@@ -140,6 +140,13 @@
$ pytest --reruns 5 --rerun-except AssertionError --rerun-except OSError
+.. note::
+
+ When the ```AssertionError``` comes from the use of the ``assert`` keyword,
+ use ``--rerun-except assert`` instead::
+
+ $ pytest --reruns 5 --rerun-except assert
+
Re-run individual failures
--------------------------
@@ -175,6 +182,27 @@
import random
assert random.choice([True, False])
+Exception filtering can be accomplished by specifying regular expressions for
+``only_rerun`` and ``rerun_except``. They override the ``--only-rerun`` and
+``--rerun-except`` command line arguments, respectively.
+
+Arguments can be a single string:
+
+.. code-block:: python
+
+ @pytest.mark.flaky(rerun_except="AssertionError")
+ def test_example():
+ raise AssertionError()
+
+Or a list of strings:
+
+.. code-block:: python
+
+ @pytest.mark.flaky(only_rerun=["AssertionError", "ValueError"])
+ def test_example():
+ raise AssertionError()
+
+
You can use ``@pytest.mark.flaky(condition)`` similarly as
``@pytest.mark.skipif(condition)``, see `pytest-mark-skipif
<https://docs.pytest.org/en/6.2.x/reference.html#pytest-mark-skipif>`_
.. code-block:: python
@@ -223,6 +251,9 @@
* This plugin may *not* be used with class, module, and package level fixtures.
* This plugin is *not* compatible with pytest-xdist's --looponfail flag.
* This plugin is *not* compatible with the core --pdb flag.
+* This plugin is *not* compatible with the plugin
+ `flaky <https://pypi.org/project/flaky/>`_, you can only have
+ ``pytest-rerunfailures`` or ``flaky`` but not both.
Resources
---------
@@ -245,20 +276,54 @@
Changelog
=========
+12.0 (2023-07-05)
+-----------------
+
+Breaking changes
+++++++++++++++++
+
+- Drop support for pytest < 6.2.
+
+Features
+++++++++
+
+- Add ``only_rerun`` and ``rerun_except`` arguments to ``@pytest.mark.flaky``
marker.
+
+- Add support for pytest 7.3, 7.4.
+
+Bug fixes
++++++++++
+
+- Failures are now rerun only if they match at least one ``--only-rerun``
+ pattern (if given) and none of the ``--rerun-except`` patterns. Previously,
+ using both ``--only-rerun`` and ``--rerun-except`` together could cause
+ failures to be rerun even if they did not match any ``--only-rerun``
+ pattern, and when using multiple ``--rerun-except`` patterns, all failures
+ would be rerun unless they matched every pattern.
+ (`#225 <https://github.com/pytest-dev/pytest-rerunfailures/issues/225>`_)
+
+
11.1.2 (2023-03-09)
-------------------
+Bug fixes
++++++++++
+
- Execute teardown when test was skipped in setup phase of a fixture.
11.1.1 (2023-02-17)
-------------------
+Bug fixes
++++++++++
+
- Fix crash during teardown when runtest protocol hook is overwritten by
another plugin.
- Fix crash during teardown when TestCase class is used as base class.
+
11.1 (2023-02-09)
-----------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-rerunfailures-11.1.2/pytest_rerunfailures.egg-info/requires.txt
new/pytest-rerunfailures-12.0/pytest_rerunfailures.egg-info/requires.txt
--- old/pytest-rerunfailures-11.1.2/pytest_rerunfailures.egg-info/requires.txt
2023-03-09 08:17:57.000000000 +0100
+++ new/pytest-rerunfailures-12.0/pytest_rerunfailures.egg-info/requires.txt
2023-07-05 07:53:42.000000000 +0200
@@ -1,5 +1,5 @@
packaging>=17.1
-pytest>=5.3
+pytest>=6.2
[:python_version < "3.8"]
importlib-metadata>=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-rerunfailures-11.1.2/pytest_rerunfailures.py
new/pytest-rerunfailures-12.0/pytest_rerunfailures.py
--- old/pytest-rerunfailures-11.1.2/pytest_rerunfailures.py 2023-03-09
08:17:56.000000000 +0100
+++ new/pytest-rerunfailures-12.0/pytest_rerunfailures.py 2023-07-05
07:53:41.000000000 +0200
@@ -302,38 +302,68 @@
setup_state.stack = []
-def _should_hard_fail_on_error(session_config, report):
- if report.outcome != "failed":
- return False
+def _get_rerun_filter_regex(item, regex_name):
+ rerun_marker = _get_marker(item)
- rerun_errors = session_config.option.only_rerun
- rerun_except_errors = session_config.option.rerun_except
+ if rerun_marker is not None and regex_name in rerun_marker.kwargs:
+ regex = rerun_marker.kwargs[regex_name]
+ if isinstance(regex, str):
+ regex = [regex]
+ else:
+ regex = getattr(item.session.config.option, regex_name)
+
+ return regex
+
+
+def _matches_any_rerun_error(rerun_errors, report):
+ for rerun_regex in rerun_errors:
+ try:
+ if re.search(rerun_regex, report.longrepr.reprcrash.message):
+ return True
+ except AttributeError:
+ if re.search(rerun_regex, report.longreprtext):
+ return True
+ return False
+
+
+def _matches_any_rerun_except_error(rerun_except_errors, report):
+ for rerun_regex in rerun_except_errors:
+ if re.search(rerun_regex, report.longrepr.reprcrash.message):
+ return True
+ return False
- if not rerun_errors and not rerun_except_errors:
+def _should_hard_fail_on_error(item, report):
+ if report.outcome != "failed":
return False
- if rerun_errors:
- for rerun_regex in rerun_errors:
- try:
- if re.search(rerun_regex, report.longrepr.reprcrash.message):
- return False
- except AttributeError:
- if re.search(rerun_regex, report.longreprtext):
- return False
-
- if rerun_except_errors:
- for rerun_regex in rerun_except_errors:
- if not re.search(rerun_regex, report.longrepr.reprcrash.message):
+ rerun_errors = _get_rerun_filter_regex(item, "only_rerun")
+ rerun_except_errors = _get_rerun_filter_regex(item, "rerun_except")
- return False
+ if (not rerun_errors) and (not rerun_except_errors):
+ # Using neither --only-rerun nor --rerun-except
+ return False
- return True
+ elif rerun_errors and (not rerun_except_errors):
+ # Using --only-rerun but not --rerun-except
+ return not _matches_any_rerun_error(rerun_errors, report)
+
+ elif (not rerun_errors) and rerun_except_errors:
+ # Using --rerun-except but not --only-rerun
+ return _matches_any_rerun_except_error(rerun_except_errors, report)
+
+ else:
+ # Using both --only-rerun and --rerun-except
+ matches_rerun_only = _matches_any_rerun_error(rerun_errors, report)
+ matches_rerun_except = _matches_any_rerun_except_error(
+ rerun_except_errors, report
+ )
+ return (not matches_rerun_only) or matches_rerun_except
def _should_not_rerun(item, report, reruns):
xfail = hasattr(report, "wasxfail")
- is_terminal_error = _should_hard_fail_on_error(item.session.config, report)
+ is_terminal_error = _should_hard_fail_on_error(item, report)
condition = get_reruns_condition(item)
return (
item.execution_count > reruns
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-rerunfailures-11.1.2/setup.cfg
new/pytest-rerunfailures-12.0/setup.cfg
--- old/pytest-rerunfailures-11.1.2/setup.cfg 2023-03-09 08:17:57.546177400
+0100
+++ new/pytest-rerunfailures-12.0/setup.cfg 2023-07-05 07:53:42.353158000
+0200
@@ -7,7 +7,7 @@
[metadata]
name = pytest-rerunfailures
-version = 11.1.2
+version = 12.0
url = https://github.com/pytest-dev/pytest-rerunfailures
description = pytest plugin to re-run tests to eliminate flaky failures
long_description = file: HEADER.rst, README.rst, CHANGES.rst
@@ -42,7 +42,7 @@
python_requires = >= 3.7
install_requires =
packaging >= 17.1
- pytest >= 5.3
+ pytest >= 6.2
importlib-metadata>=1;python_version<"3.8"
[options.entry_points]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-rerunfailures-11.1.2/test_pytest_rerunfailures.py
new/pytest-rerunfailures-12.0/test_pytest_rerunfailures.py
--- old/pytest-rerunfailures-11.1.2/test_pytest_rerunfailures.py
2023-03-09 08:17:56.000000000 +0100
+++ new/pytest-rerunfailures-12.0/test_pytest_rerunfailures.py 2023-07-05
07:53:41.000000000 +0200
@@ -575,6 +575,7 @@
(["AssertionError: "], True),
(["ERR"], False),
(["AssertionError", "OSError"], True),
+ (["ValueError", "OSError"], False),
],
)
def test_rerun_except_flag(testdir, rerun_except_texts, should_rerun):
@@ -587,7 +588,44 @@
pytest_args = ["--reruns", str(num_reruns)]
for rerun_except_text in rerun_except_texts:
- print(rerun_except_text)
+ pytest_args.extend(["--rerun-except", rerun_except_text])
+ result = testdir.runpytest(*pytest_args)
+ assert_outcomes(
+ result, passed=num_passed, failed=num_failed, rerun=num_reruns_actual
+ )
+
+
[email protected](
+ "only_rerun_texts, rerun_except_texts, should_rerun",
+ [
+ # Matches --only-rerun, but not --rerun-except (rerun)
+ (["ValueError"], ["Not a Match"], True),
+ (["ValueError", "AssertionError"], ["Not a match", "OSError"], True),
+ # Matches --only-rerun AND --rerun-except (no rerun)
+ (["ValueError"], ["ERR"], False),
+ (["OSError", "ValueError"], ["Not a match", "ERR"], False),
+ # Matches --rerun-except, but not --only-rerun (no rerun)
+ (["OSError", "AssertionError"], ["TypeError", "ValueError"], False),
+ # Matches neither --only-rerun nor --rerun-except (no rerun)
+ (["AssertionError"], ["OSError"], False),
+ # --rerun-except overrides --only-rerun for same arg (no rerun)
+ (["ValueError"], ["ValueError"], False),
+ ],
+)
+def test_rerun_except_and_only_rerun(
+ testdir, rerun_except_texts, only_rerun_texts, should_rerun
+):
+ testdir.makepyfile('def test_only_rerun_except(): raise ValueError("ERR")')
+
+ num_failed = 1
+ num_passed = 0
+ num_reruns = 1
+ num_reruns_actual = num_reruns if should_rerun else 0
+
+ pytest_args = ["--reruns", str(num_reruns)]
+ for only_rerun_text in only_rerun_texts:
+ pytest_args.extend(["--only-rerun", only_rerun_text])
+ for rerun_except_text in rerun_except_texts:
pytest_args.extend(["--rerun-except", rerun_except_text])
result = testdir.runpytest(*pytest_args)
assert_outcomes(
@@ -659,6 +697,77 @@
assert_outcomes(result, passed=0, failed=1, rerun=2)
[email protected](
+ "marker_only_rerun,cli_only_rerun,should_rerun",
+ [
+ ("AssertionError", None, True),
+ ("AssertionError: ERR", None, True),
+ (["AssertionError"], None, True),
+ (["AssertionError: ABC"], None, False),
+ ("ValueError", None, False),
+ (["ValueError"], None, False),
+ (["AssertionError", "ValueError"], None, True),
+ # CLI override behavior
+ ("AssertionError", "ValueError", True),
+ ("ValueError", "AssertionError", False),
+ ],
+)
+def test_only_rerun_flag_in_flaky_marker(
+ testdir, marker_only_rerun, cli_only_rerun, should_rerun
+):
+ testdir.makepyfile(
+ f"""
+ import pytest
+
+ @pytest.mark.flaky(reruns=1, only_rerun={marker_only_rerun!r})
+ def test_fail():
+ raise AssertionError("ERR")
+ """
+ )
+ args = []
+ if cli_only_rerun:
+ args.extend(["--only-rerun", cli_only_rerun])
+ result = testdir.runpytest()
+ num_reruns = 1 if should_rerun else 0
+ assert_outcomes(result, passed=0, failed=1, rerun=num_reruns)
+
+
[email protected](
+ "marker_rerun_except,cli_rerun_except,should_rerun",
+ [
+ ("AssertionError", None, False),
+ ("AssertionError: ERR", None, False),
+ (["AssertionError"], None, False),
+ (["AssertionError: ABC"], None, True),
+ ("ValueError", None, True),
+ (["ValueError"], None, True),
+ (["OSError", "ValueError"], None, True),
+ (["OSError", "AssertionError"], None, False),
+ # CLI override behavior
+ ("AssertionError", "ValueError", False),
+ ("ValueError", "AssertionError", True),
+ ],
+)
+def test_rerun_except_flag_in_flaky_marker(
+ testdir, marker_rerun_except, cli_rerun_except, should_rerun
+):
+ testdir.makepyfile(
+ f"""
+ import pytest
+
+ @pytest.mark.flaky(reruns=1, rerun_except={marker_rerun_except!r})
+ def test_fail():
+ raise AssertionError("ERR")
+ """
+ )
+ args = []
+ if cli_rerun_except:
+ args.extend(["--rerun-except", cli_rerun_except])
+ result = testdir.runpytest(*args)
+ num_reruns = 1 if should_rerun else 0
+ assert_outcomes(result, passed=0, failed=1, rerun=num_reruns)
+
+
def test_ini_file_parameters(testdir):
testdir.makepyfile(
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-rerunfailures-11.1.2/tox.ini
new/pytest-rerunfailures-12.0/tox.ini
--- old/pytest-rerunfailures-11.1.2/tox.ini 2023-03-09 08:17:56.000000000
+0100
+++ new/pytest-rerunfailures-12.0/tox.ini 2023-07-05 07:53:41.000000000
+0200
@@ -11,21 +11,20 @@
[tox]
envlist =
linting
- py{37,38,39,py3}-pytest{60,61}
- py{37,38,39,310,311,py3}-pytest{62,70,71,72}
- py{37,38,39,310,311,py3}-pytest{main}
+ py{37,38,39,310,311,py3}-pytest{62,70,71,72,73,74}
+ py{38,39,310,311,py3}-pytest{main}
minversion = 4.0
[testenv]
commands = pytest test_pytest_rerunfailures.py {posargs}
deps =
pytest-xdist
- pytest60: pytest==6.0.*
- pytest61: pytest==6.1.*
pytest62: pytest==6.2.*
pytest70: pytest==7.0.*
pytest71: pytest==7.1.*
pytest72: pytest==7.2.*
+ pytest73: pytest==7.3.*
+ pytest74: pytest==7.4.*
pytestmain: git+https://github.com/pytest-dev/pytest.git@main#egg=pytest
[testenv:linting]