diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 17cc79b..9ff84ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,10 +27,10 @@ jobs: "3.9", "3.10", "3.11", + "3.12", "pypy-3.9", ] pytest-version: [ - "6.2.*", "7.0.*", "7.1.*", "7.2.*", @@ -39,7 +39,7 @@ jobs: "main", ] exclude: - # pytest-main opnly supports Python 3.8+ + # pytest-main only supports Python 3.8+ - { python-version: "3.7", pytest-version: "main" } steps: - uses: actions/checkout@v3 diff --git a/CHANGES.rst b/CHANGES.rst index a06912f..dfaf40a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,9 +1,22 @@ Changelog ========= -12.1 (unreleased) +13.0 (unreleased) ----------------- +Breaking changes +++++++++++++++++ + +- Drop support for pytest < 7.0. + +Features +++++++++ + +- Add support for Python 3.12. + +Bug fixes ++++++++++ + - Fix crashitem names mismatch between client and server. (`#172 `_) diff --git a/README.rst b/README.rst index 88a7e4b..f17d4e1 100644 --- a/README.rst +++ b/README.rst @@ -19,8 +19,8 @@ Requirements You will need the following prerequisites in order to use pytest-rerunfailures: -- Python 3.7, up to 3.11, or PyPy3 -- pytest 6.0 or newer +- Python 3.7, up to 3.12, or PyPy3 +- pytest 7.0 or newer This plugin can recover from a hard crash with the following optional prerequisites: diff --git a/pytest_rerunfailures.py b/pytest_rerunfailures.py index 656cd91..12b09e6 100644 --- a/pytest_rerunfailures.py +++ b/pytest_rerunfailures.py @@ -28,8 +28,6 @@ except ImportError: HAS_PYTEST_HANDLECRASHITEM = False -PYTEST_GTE_63 = parse_version(pytest.__version__) >= parse_version("6.3.0") - def works_with_current_xdist(): """Return compatibility with installed pytest-xdist version. @@ -241,13 +239,7 @@ def _remove_failed_setup_state_from_session(item): and clean the stack itself """ setup_state = item.session._setupstate - if PYTEST_GTE_63: - setup_state.stack = {} - else: - for node in setup_state.stack: - if hasattr(node, "_prepare_exc"): - del node._prepare_exc - setup_state.stack = [] + setup_state.stack = {} def _get_rerun_filter_regex(item, regex_name): @@ -500,14 +492,9 @@ def pytest_runtest_teardown(item, nextitem): _remove_cached_results_from_failed_fixtures(item) if item in item.session._setupstate.stack: - if PYTEST_GTE_63: - for key in list(item.session._setupstate.stack.keys()): - if key != item: - del item.session._setupstate.stack[key] - else: - for node in list(item.session._setupstate.stack): - if node != item: - item.session._setupstate.stack.remove(node) + for key in list(item.session._setupstate.stack.keys()): + if key != item: + del item.session._setupstate.stack[key] @pytest.hookimpl(hookwrapper=True) diff --git a/setup.cfg b/setup.cfg index ae553c8..1a4d42c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ ignore = [metadata] name = pytest-rerunfailures -version = 12.1.dev0 +version = 13.0.dev0 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 @@ -32,6 +32,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy @@ -42,7 +43,7 @@ py_modules = pytest_rerunfailures python_requires = >= 3.7 install_requires = packaging >= 17.1 - pytest >= 6.2 + pytest >= 7 importlib-metadata>=1;python_version<"3.8" [options.entry_points] diff --git a/tox.ini b/tox.ini index dbb4091..f87f006 100644 --- a/tox.ini +++ b/tox.ini @@ -11,15 +11,14 @@ max-line-length = 88 [tox] envlist = linting - py{37,38,39,310,311,py3}-pytest{62,70,71,72,73,74} - py{38,39,310,311,py3}-pytest{main} + py{37,38,39,310,311,312,py3}-pytest{70,71,72,73,74} + py{38,39,310,311,312,py3}-pytest{main} minversion = 4.0 [testenv] commands = pytest test_pytest_rerunfailures.py {posargs} deps = pytest-xdist - pytest62: pytest==6.2.* pytest70: pytest==7.0.* pytest71: pytest==7.1.* pytest72: pytest==7.2.*