diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c105e3d..5d86b49 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,8 @@ jobs: "5.4.*", "6.0.*", "6.1.*", + "6.2.*", + "master", ] steps: - uses: actions/checkout@v2 @@ -58,7 +60,11 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - python -m pip install pytest==${{ matrix.pytest-version }} + if [[ '${{ matrix.pytest-version }}' == 'master' ]]; then + python -m pip install git+https://github.com/pytest-dev/pytest.git@master#egg=pytest + else + python -m pip install pytest==${{ matrix.pytest-version }} + fi python -m pip install -e . - name: Tests diff --git a/CHANGES.rst b/CHANGES.rst index f1771ab..d517ccb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,6 +18,9 @@ Features - Add support for Python 3.9. (Thanks to `@digitronik`_ for the PR) +- Add support for pytest 6.3. + (Thanks to `@bluetech`_ for the PR) + Other changes +++++++++++++ @@ -26,6 +29,7 @@ Other changes .. _@BeyondEvil: https://github.com/BeyondEvil .. _@digitronik: https://github.com/digitronik +.. _@bluetech: https://github.com/bluetech 9.1.1 (2020-09-29) ------------------ diff --git a/pytest_rerunfailures.py b/pytest_rerunfailures.py index 908d4b7..6787731 100644 --- a/pytest_rerunfailures.py +++ b/pytest_rerunfailures.py @@ -21,6 +21,10 @@ pytest.__version__ ) >= pkg_resources.parse_version("5.4") +PYTEST_GTE_63 = pkg_resources.parse_version( + pytest.__version__ +) >= pkg_resources.parse_version("6.3.0.dev") + def works_with_current_xdist(): """Returns compatibility with installed pytest-xdist version. @@ -205,15 +209,17 @@ def _remove_cached_results_from_failed_fixtures(item): def _remove_failed_setup_state_from_session(item): """ - Note: remove all _prepare_exc attribute from every col in stack of - _setupstate and cleaning the stack itself + Note: remove all failures from every node in _setupstate stack + and clean the stack itself """ - prepare_exc = "_prepare_exc" - setup_state = getattr(item.session, "_setupstate") - for col in setup_state.stack: - if hasattr(col, prepare_exc): - delattr(col, prepare_exc) - setup_state.stack = list() + 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 = [] def _should_hard_fail_on_error(session_config, report): diff --git a/tox.ini b/tox.ini index 90694b3..c69ccca 100644 --- a/tox.ini +++ b/tox.ini @@ -24,6 +24,8 @@ deps = pytest54: pytest==5.4.* pytest60: pytest==6.0.* pytest61: pytest==6.1.* + pytest62: pytest==6.2.* + pytestmaster: git+https://github.com/pytest-dev/pytest.git@master#egg=pytest [testenv:linting] basepython = python3