diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b779279fdc..5a943535787 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: main on: push: branches: - - master + - main - "[0-9]+.[0-9]+.x" tags: - "[0-9]+.[0-9]+.[0-9]+" @@ -11,13 +11,18 @@ on: pull_request: branches: - - master + - main - "[0-9]+.[0-9]+.x" +# Set permissions at the job level. +permissions: {} + jobs: build: runs-on: ${{ matrix.os }} timeout-minutes: 30 + permissions: + contents: read strategy: fail-fast: false @@ -27,6 +32,8 @@ jobs: "windows-py37", "windows-py37-pluggy", "windows-py38", + "windows-py39", + "windows-py310", "ubuntu-py36", "ubuntu-py37", @@ -34,6 +41,7 @@ jobs: "ubuntu-py37-freeze", "ubuntu-py38", "ubuntu-py39", + "ubuntu-py310", "ubuntu-pypy3", "macos-py37", @@ -56,12 +64,20 @@ jobs: - name: "windows-py37-pluggy" python: "3.7" os: windows-latest - tox_env: "py37-pluggymaster-xdist" + tox_env: "py37-pluggymain-xdist" - name: "windows-py38" python: "3.8" os: windows-latest tox_env: "py38-unittestextras" use_coverage: true + - name: "windows-py39" + python: "3.9" + os: windows-latest + tox_env: "py39-xdist" + - name: "windows-py310" + python: "3.10-dev" + os: windows-latest + tox_env: "py310-xdist" - name: "ubuntu-py36" python: "3.6" @@ -75,7 +91,7 @@ jobs: - name: "ubuntu-py37-pluggy" python: "3.7" os: ubuntu-latest - tox_env: "py37-pluggymaster-xdist" + tox_env: "py37-pluggymain-xdist" - name: "ubuntu-py37-freeze" python: "3.7" os: ubuntu-latest @@ -88,6 +104,10 @@ jobs: python: "3.9" os: ubuntu-latest tox_env: "py39-xdist" + - name: "ubuntu-py310" + python: "3.10-dev" + os: ubuntu-latest + tox_env: "py310-xdist" - name: "ubuntu-pypy3" python: "pypy3" os: ubuntu-latest @@ -122,10 +142,13 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + persist-credentials: false + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -156,19 +179,29 @@ jobs: linting: runs-on: ubuntu-latest + permissions: + contents: read + steps: - uses: actions/checkout@v2 + with: + persist-credentials: false + - uses: actions/setup-python@v2 + - name: set PY run: echo "name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV + - uses: actions/cache@v2 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install dependencies run: | python -m pip install --upgrade pip pip install tox + - run: tox -e linting deploy: @@ -176,6 +209,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 + permissions: + contents: write needs: [build] @@ -183,25 +218,31 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + persist-credentials: false + - name: Set up Python uses: actions/setup-python@v2 with: python-version: "3.7" + - name: Install dependencies run: | python -m pip install --upgrade pip pip install --upgrade wheel setuptools tox + - name: Build package run: | python setup.py sdist bdist_wheel + - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@master with: user: __token__ password: ${{ secrets.pypi_token }} + - name: Publish GitHub release notes env: - GH_RELEASE_NOTES_TOKEN: ${{ secrets.release_notes }} + GH_RELEASE_NOTES_TOKEN: ${{ github.token }} run: | sudo apt-get install pandoc tox -e publish-gh-release-notes diff --git a/.github/workflows/release-on-comment.yml b/.github/workflows/release-on-comment.yml index 94863d896b9..32d22155223 100644 --- a/.github/workflows/release-on-comment.yml +++ b/.github/workflows/release-on-comment.yml @@ -7,9 +7,15 @@ on: issue_comment: types: [created, edited] +# Set permissions at the job level. +permissions: {} + jobs: build: runs-on: ubuntu-latest + permissions: + contents: write + issues: write if: (github.event.comment && startsWith(github.event.comment.body, '@pytestbot please')) || (github.event.issue && !github.event.comment && startsWith(github.event.issue.body, '@pytestbot please')) @@ -17,15 +23,18 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + persist-credentials: false - name: Set up Python uses: actions/setup-python@v2 with: python-version: "3.8" + - name: Install dependencies run: | python -m pip install --upgrade pip pip install --upgrade setuptools tox + - name: Prepare release run: | - tox -e release-on-comment -- $GITHUB_EVENT_PATH ${{ secrets.chatops }} + tox -e release-on-comment -- $GITHUB_EVENT_PATH ${{ github.token }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 68cc3273bba..96e733ba01d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,11 +39,10 @@ repos: - id: pyupgrade args: [--py36-plus] - repo: https://github.com/asottile/setup-cfg-fmt - rev: v1.11.0 + rev: v1.17.0 hooks: - id: setup-cfg-fmt - # TODO: when upgrading setup-cfg-fmt this can be removed - args: [--max-py-version=3.9] + args: [--max-py-version=3.10] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.6.0 hooks: diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 2669cb19509..b2f6785d24e 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -236,7 +236,7 @@ Here is a simple overview, with pytest-specific bits: $ cd pytest # now, create your own branch off "master": - $ git checkout -b your-bugfix-branch-name master + $ git checkout -b your-bugfix-branch-name main Given we have "major.minor.micro" version numbers, bug fixes will usually be released in micro releases whereas features will be released in @@ -318,7 +318,7 @@ Here is a simple overview, with pytest-specific bits: compare: your-branch-name base-fork: pytest-dev/pytest - base: master + base: main Writing Tests diff --git a/README.rst b/README.rst index 398d6451c58..a6ba517c66a 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -.. image:: https://docs.pytest.org/en/stable/_static/pytest1.png +.. image:: https://github.com/pytest-dev/pytest/raw/main/doc/en/img/pytest_logo_curves.svg :target: https://docs.pytest.org/en/stable/ :align: center :alt: pytest @@ -15,7 +15,7 @@ .. image:: https://img.shields.io/pypi/pyversions/pytest.svg :target: https://pypi.org/project/pytest/ -.. image:: https://codecov.io/gh/pytest-dev/pytest/branch/master/graph/badge.svg +.. image:: https://codecov.io/gh/pytest-dev/pytest/branch/main/graph/badge.svg :target: https://codecov.io/gh/pytest-dev/pytest :alt: Code coverage Status @@ -25,6 +25,10 @@ .. image:: https://github.com/pytest-dev/pytest/workflows/main/badge.svg :target: https://github.com/pytest-dev/pytest/actions?query=workflow%3Amain +.. image:: https://results.pre-commit.ci/badge/github/pytest-dev/pytest/main.svg + :target: https://results.pre-commit.ci/latest/github/pytest-dev/pytest/master + :alt: pre-commit.ci status + .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black @@ -149,8 +153,8 @@ Tidelift will coordinate the fix and disclosure. License ------- -Copyright Holger Krekel and others, 2004-2020. +Copyright Holger Krekel and others, 2004-2021. Distributed under the terms of the `MIT`_ license, pytest is free and open source software. -.. _`MIT`: https://github.com/pytest-dev/pytest/blob/master/LICENSE +.. _`MIT`: https://github.com/pytest-dev/pytest/blob/main/LICENSE diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 7751405a196..f0c84cb4c47 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-6.2.5 release-6.2.4 release-6.2.3 release-6.2.2 diff --git a/doc/en/announce/release-6.2.5.rst b/doc/en/announce/release-6.2.5.rst new file mode 100644 index 00000000000..bc6b4cf4222 --- /dev/null +++ b/doc/en/announce/release-6.2.5.rst @@ -0,0 +1,30 @@ +pytest-6.2.5 +======================================= + +pytest 6.2.5 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/stable/changelog.html. + +Thanks to all of the contributors to this release: + +* Anthony Sottile +* Bruno Oliveira +* Brylie Christopher Oxley +* Daniel Asztalos +* Florian Bruhin +* Jason Haugen +* MapleCCC +* Michał Górny +* Miro Hrončok +* Ran Benita +* Ronny Pfannschmidt +* Sylvain Bellemare +* Thomas Güttler + + +Happy testing, +The pytest Development Team diff --git a/doc/en/assert.rst b/doc/en/assert.rst index b83e30e76db..b5d2e057d8e 100644 --- a/doc/en/assert.rst +++ b/doc/en/assert.rst @@ -31,7 +31,7 @@ you will see the return value of the function call: $ pytest test_assert1.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -188,7 +188,7 @@ if you run this module: $ pytest test_assert2.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/cache.rst b/doc/en/cache.rst index 42ca473545d..c235408d01f 100644 --- a/doc/en/cache.rst +++ b/doc/en/cache.rst @@ -86,7 +86,7 @@ If you then run it with ``--lf``: $ pytest --lf =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -133,7 +133,7 @@ of ``FF`` and dots): $ pytest --ff =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 50 items @@ -277,7 +277,7 @@ You can always peek at the content of the cache using the $ pytest --cache-show =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR cachedir: $PYTHON_PREFIX/.pytest_cache @@ -358,7 +358,7 @@ filtering: $ pytest --cache-show example/* =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR cachedir: $PYTHON_PREFIX/.pytest_cache diff --git a/doc/en/capture.rst b/doc/en/capture.rst index caaebdf81a8..9b0c1041418 100644 --- a/doc/en/capture.rst +++ b/doc/en/capture.rst @@ -83,7 +83,7 @@ of the failing function and hide the other one: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 16b41bd78e5..6f69835a8bd 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,19 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 6.2.5 (2021-08-29) +========================= + + +Trivial/Internal Changes +------------------------ + +- `#8494 `_: Python 3.10 is now supported. + + +- `#9040 `_: Enable compatibility with ``pluggy 1.0`` or later. + + pytest 6.2.4 (2021-05-04) ========================= diff --git a/doc/en/contact.rst b/doc/en/contact.rst index efc6a8f57d3..25d8358fdb7 100644 --- a/doc/en/contact.rst +++ b/doc/en/contact.rst @@ -7,21 +7,22 @@ Contact channels - `pytest issue tracker`_ to report bugs or suggest features (for version 2.0 and above). - +- `pytest discussions`_ at github for general questions. - `pytest on stackoverflow.com `_ - to post questions with the tag ``pytest``. New Questions will usually + to post precise questions with the tag ``pytest``. New Questions will usually be seen by pytest users or developers and answered quickly. - `Testing In Python`_: a mailing list for Python testing tools and discussion. - `pytest-dev at python.org (mailing list)`_ pytest specific announcements and discussions. -- `pytest-commit at python.org (mailing list)`_: for commits and new issues - - :doc:`contribution guide ` for help on submitting pull requests to GitHub. -- ``#pylib`` on irc.freenode.net IRC channel for random questions. +- ``#pytest`` `on irc.libera.chat `_ IRC + channel for random questions (using an IRC client, `via webchat + `_, or `via Matrix + `_). - private mail to Holger.Krekel at gmail com if you want to communicate sensitive issues @@ -32,6 +33,8 @@ Contact channels .. _`pytest issue tracker`: https://github.com/pytest-dev/pytest/issues .. _`old issue tracker`: http://bitbucket.org/hpk42/py-trunk/issues/ +.. _`pytest discussions`: https://github.com/pytest-dev/pytest/discussions + .. _`merlinux.eu`: http://merlinux.eu .. _`get an account`: diff --git a/doc/en/development_guide.rst b/doc/en/development_guide.rst index 77076d4834e..3ee0ebbc239 100644 --- a/doc/en/development_guide.rst +++ b/doc/en/development_guide.rst @@ -4,4 +4,4 @@ Development Guide The contributing guidelines are to be found :ref:`here `. The release procedure for pytest is documented on -`GitHub `_. +`GitHub `_. diff --git a/doc/en/doctest.rst b/doc/en/doctest.rst index f8d010679f0..dd76b4ceb71 100644 --- a/doc/en/doctest.rst +++ b/doc/en/doctest.rst @@ -29,7 +29,7 @@ then you can just invoke ``pytest`` directly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -58,7 +58,7 @@ and functions, including from test modules: $ pytest --doctest-modules =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index f0effa02631..db05707e686 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -45,7 +45,7 @@ You can then restrict a test run to only run tests marked with ``webtest``: $ pytest -v -m webtest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 3 deselected / 1 selected @@ -60,7 +60,7 @@ Or the inverse, running all tests except the webtest ones: $ pytest -v -m "not webtest" =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 1 deselected / 3 selected @@ -82,7 +82,7 @@ tests based on their module, class, method, or function name: $ pytest -v test_server.py::TestClass::test_method =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 1 item @@ -97,7 +97,7 @@ You can also select on the class: $ pytest -v test_server.py::TestClass =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 1 item @@ -112,7 +112,7 @@ Or select multiple nodes: $ pytest -v test_server.py::TestClass test_server.py::test_send_http =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 2 items @@ -156,7 +156,7 @@ The expression matching is now case-insensitive. $ pytest -v -k http # running with the above defined example module =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 3 deselected / 1 selected @@ -171,7 +171,7 @@ And you can also run all tests except the ones that match the keyword: $ pytest -k "not send_http" -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 1 deselected / 3 selected @@ -188,7 +188,7 @@ Or to select "http" and "quick" tests: $ pytest -k "http or quick" -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 2 deselected / 2 selected @@ -397,7 +397,7 @@ the test needs: $ pytest -E stage2 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -412,7 +412,7 @@ and here is one that specifies exactly the environment needed: $ pytest -E stage1 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -605,7 +605,7 @@ then you will see two tests skipped and two executed tests as expected: $ pytest -rs # this option reports skip reasons =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -622,7 +622,7 @@ Note that if you specify a platform via the marker-command line option like this $ pytest -m linux =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 3 deselected / 1 selected @@ -686,7 +686,7 @@ We can now use the ``-m option`` to select one set: $ pytest -m interface --tb=short =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 2 deselected / 2 selected @@ -713,7 +713,7 @@ or to select both "event" and "interface" tests: $ pytest -m "interface or event" --tb=short =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 1 deselected / 3 selected diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst index a3477fe1e1d..4533642d442 100644 --- a/doc/en/example/nonpython.rst +++ b/doc/en/example/nonpython.rst @@ -29,7 +29,7 @@ now execute the test specification: nonpython $ pytest test_simple.yaml =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collected 2 items @@ -66,7 +66,7 @@ consulted when reporting in ``verbose`` mode: nonpython $ pytest -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collecting ... collected 2 items @@ -92,7 +92,7 @@ interesting to just look at the collection tree: nonpython $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collected 2 items diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 9a46bedd6e3..08d385a2f96 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -160,7 +160,7 @@ objects, they are still using the default pytest representation: $ pytest test_time.py --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 8 items @@ -225,7 +225,7 @@ this is a fully self-contained example which you can run with: $ pytest test_scenarios.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -240,7 +240,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia $ pytest --collect-only test_scenarios.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -319,7 +319,7 @@ Let's first see how it looks like at collection time: $ pytest test_backends.py --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -418,7 +418,7 @@ The result of this test will be successful: $ pytest -v test_indirect_list.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 1 item @@ -573,7 +573,7 @@ If you run this with reporting for skips enabled: $ pytest -rs test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -635,7 +635,7 @@ Then run ``pytest`` with verbose mode and with only the ``basic`` marker: $ pytest -v -m basic =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 24 items / 21 deselected / 3 selected diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index a6ce2e742e5..15889a37c1e 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -147,7 +147,7 @@ The test collection would look like this: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 2 items @@ -209,7 +209,7 @@ You can always peek at the collection tree without running tests like this: . $ pytest --collect-only pythoncollection.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 3 items @@ -291,7 +291,7 @@ file will be left out: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 0 items diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 6e7dbe49683..f7635e0acf1 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -9,7 +9,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: assertion $ pytest failure_demo.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/assertion collected 44 items diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index b641e61f718..12cc4cae486 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -175,7 +175,7 @@ directory with the above conftest.py: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 0 items @@ -240,7 +240,7 @@ and when running it will see a skipped "slow" test: $ pytest -rs # "-rs" means report details on the little 's' =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -257,7 +257,7 @@ Or run it including the ``slow`` marked test: $ pytest --runslow =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -401,7 +401,7 @@ which will add the string to the test header accordingly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache project deps: mylib-1.1 rootdir: $REGENDOC_TMPDIR @@ -430,7 +430,7 @@ which will add info only when run with "--v": $ pytest -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache info1: did you know that ... did you? @@ -445,7 +445,7 @@ and nothing when run plainly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 0 items @@ -485,7 +485,7 @@ Now we can profile which test functions execute the slowest: $ pytest --durations=3 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items @@ -591,7 +591,7 @@ If we run this: $ pytest -rx =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -675,7 +675,7 @@ We can run this: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 7 items @@ -794,7 +794,7 @@ and run them: $ pytest test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -901,7 +901,7 @@ and run it: $ pytest -s test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index a3a1e9eb415..d8046fb7fae 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -157,7 +157,7 @@ a function/method call. **Assert** is where we look at that resulting state and check if it looks how we'd expect after the dust has settled. It's where we gather evidence to say the -behavior does or does not aligns with what we expect. The ``assert`` in our test +behavior does or does not align with what we expect. The ``assert`` in our test is where we take that measurement/observation and apply our judgement to it. If something should be green, we'd say ``assert thing == "green"``. @@ -654,7 +654,7 @@ marked ``smtp_connection`` fixture function. Running the test looks like this: $ pytest test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -1454,7 +1454,7 @@ example, consider this file: .. literalinclude:: example/fixtures/test_fixtures_order_autouse_multiple_scopes.py -Even though nothing in ``TestClassWithC1Request`` is requesting ``c1``, it still +Even though nothing in ``TestClassWithoutC1Request`` is requesting ``c1``, it still is executed for the tests inside it anyway: .. image:: example/fixtures/test_fixtures_order_autouse_multiple_scopes.svg @@ -1928,7 +1928,7 @@ Running the above tests results in the following test IDs being used: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 10 items @@ -1979,7 +1979,7 @@ Running this test will *skip* the invocation of ``data_set`` with value ``2``: $ pytest test_fixture_marks.py -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 3 items @@ -2029,7 +2029,7 @@ Here we declare an ``app`` fixture which receives the previously defined $ pytest -v test_appsetup.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 2 items @@ -2109,7 +2109,7 @@ Let's run the tests in verbose mode and with looking at the print-output: $ pytest -v -s test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 8 items diff --git a/doc/en/funcarg_compare.rst b/doc/en/funcarg_compare.rst index 0c4913edff8..f8af27a1ebf 100644 --- a/doc/en/funcarg_compare.rst +++ b/doc/en/funcarg_compare.rst @@ -168,7 +168,7 @@ pytest for a long time offered a pytest_configure and a pytest_sessionstart hook which are often used to setup global resources. This suffers from several problems: -1. in distributed testing the master process would setup test resources +1. in distributed testing the managing process would setup test resources that are never needed because it only co-ordinates the test run activities of the worker processes. diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index d876368d80a..8129565df71 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -28,7 +28,7 @@ Install ``pytest`` .. code-block:: bash $ pytest --version - pytest 6.2.4 + pytest 6.2.5 .. _`simpletest`: @@ -53,7 +53,7 @@ That’s it. You can now execute the test function: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/index.rst b/doc/en/index.rst index b29c3a55c5c..244e8b4be42 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -2,7 +2,8 @@ .. sidebar:: Next Open Trainings - - `Professionelles Testen für Python mit pytest `_ (German), part of the enterPy conference, April 22nd (sold out) and May 20th, remote. + - `pytest: Professionelles Testen (nicht nur) für Python `_ (German), part of `CH-Open Workshoptage `_, September 9th, ETH Zurich, Switzerland. + - `Professional Testing with Python `_, via `Python Academy `_, February 1st to 3rd, 2022, Leipzig (Germany) and remote. Also see `previous talks and blogposts `_. @@ -35,7 +36,7 @@ To execute it: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -72,7 +73,7 @@ Features - Python 3.6+ and PyPy 3 -- Rich plugin architecture, with over 315+ `external plugins `_ and thriving community +- Rich plugin architecture, with over 315+ `external plugins `_ and thriving community Documentation @@ -129,8 +130,8 @@ Tidelift will coordinate the fix and disclosure. License ------- -Copyright Holger Krekel and others, 2004-2020. +Copyright Holger Krekel and others, 2004-2021. Distributed under the terms of the `MIT`_ license, pytest is free and open source software. -.. _`MIT`: https://github.com/pytest-dev/pytest/blob/master/LICENSE +.. _`MIT`: https://github.com/pytest-dev/pytest/blob/main/LICENSE diff --git a/doc/en/license.rst b/doc/en/license.rst index c6c10bbf358..13765be1595 100644 --- a/doc/en/license.rst +++ b/doc/en/license.rst @@ -29,4 +29,4 @@ Distributed under the terms of the `MIT`_ license, pytest is free and open sourc OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -.. _`MIT`: https://github.com/pytest-dev/pytest/blob/master/LICENSE +.. _`MIT`: https://github.com/pytest-dev/pytest/blob/main/LICENSE diff --git a/doc/en/parametrize.rst b/doc/en/parametrize.rst index 9e531ddd45d..555c54d753b 100644 --- a/doc/en/parametrize.rst +++ b/doc/en/parametrize.rst @@ -56,7 +56,7 @@ them in turn: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items @@ -134,7 +134,7 @@ Let's run this: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 8aa95ca6448..d92a45711c2 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -920,11 +920,8 @@ TestReport _Result ~~~~~~~ -Result used within :ref:`hook wrappers `. +Result object used within :ref:`hook wrappers `, see :py:class:`_Result in the pluggy documentation ` for more information. -.. autoclass:: pluggy.callers._Result -.. automethod:: pluggy.callers._Result.get_result -.. automethod:: pluggy.callers._Result.force_result Global Variables ---------------- diff --git a/doc/en/requirements.txt b/doc/en/requirements.txt index fa37acfb447..ea2b428e3e3 100644 --- a/doc/en/requirements.txt +++ b/doc/en/requirements.txt @@ -1,4 +1,5 @@ pallets-sphinx-themes +pluggy>=1.0 pygments-pytest>=1.1.0 sphinx-removed-in>=0.2.0 sphinx>=3.1,<4 diff --git a/doc/en/skipping.rst b/doc/en/skipping.rst index 282820545c3..eb233e09c2d 100644 --- a/doc/en/skipping.rst +++ b/doc/en/skipping.rst @@ -373,7 +373,7 @@ Running it with the report-on-xfail option gives this output: example $ pytest -rx xfail_demo.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/example collected 7 items diff --git a/doc/en/tmpdir.rst b/doc/en/tmpdir.rst index adcba02cb15..dcfccd8027f 100644 --- a/doc/en/tmpdir.rst +++ b/doc/en/tmpdir.rst @@ -39,7 +39,7 @@ Running this would result in a passed test except for the last $ pytest test_tmp_path.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -109,7 +109,7 @@ Running this would result in a passed test except for the last $ pytest test_tmpdir.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/unittest.rst b/doc/en/unittest.rst index 130e7705b8d..fa7ea3840df 100644 --- a/doc/en/unittest.rst +++ b/doc/en/unittest.rst @@ -137,7 +137,7 @@ the ``self.db`` values in the traceback: $ pytest test_unittest_db.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/usage.rst b/doc/en/usage.rst index fbd3333dabc..581463e1346 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -218,7 +218,7 @@ Example: $ pytest -ra =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items @@ -276,7 +276,7 @@ More than one character can be used, so for example to only see failed and skipp $ pytest -rfs =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items @@ -312,7 +312,7 @@ captured output: $ pytest -rpP =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items diff --git a/doc/en/warnings.rst b/doc/en/warnings.rst index 5bbbcacbea0..4ffe6f24563 100644 --- a/doc/en/warnings.rst +++ b/doc/en/warnings.rst @@ -28,7 +28,7 @@ Running pytest now produces this output: $ pytest test_show_warnings.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -173,8 +173,6 @@ DeprecationWarning and PendingDeprecationWarning ------------------------------------------------ - - By default pytest will display ``DeprecationWarning`` and ``PendingDeprecationWarning`` warnings from user code and third-party libraries, as recommended by `PEP-0565 `_. This helps users keep their code modern and avoid breakages when deprecated warnings are effectively removed. @@ -230,27 +228,8 @@ that a certain function call triggers a ``DeprecationWarning`` or This test will fail if ``myfunction`` does not issue a deprecation warning when called with a ``17`` argument. -By default, ``DeprecationWarning`` and ``PendingDeprecationWarning`` will not be -caught when using :func:`pytest.warns` or :ref:`recwarn ` because -the default Python warnings filters hide -them. If you wish to record them in your own code, use -``warnings.simplefilter('always')``: - -.. code-block:: python - - import warnings - import pytest - - - def test_deprecation(recwarn): - warnings.simplefilter("always") - myfunction(17) - assert len(recwarn) == 1 - assert recwarn.pop(DeprecationWarning) -The :ref:`recwarn ` fixture automatically ensures to reset the warnings -filter at the end of the test, so no global state is leaked. .. _`asserting warnings`: @@ -317,9 +296,9 @@ additional information: Alternatively, you can examine raised warnings in detail using the :ref:`recwarn ` fixture (see below). -.. note:: - ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated - differently; see :ref:`ensuring_function_triggers`. + +The :ref:`recwarn ` fixture automatically ensures to reset the warnings +filter at the end of the test, so no global state is leaked. .. _`recording warnings`: diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 908366d5290..21b8464ec0f 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -442,7 +442,7 @@ Additionally it is possible to copy examples for an example folder before runnin $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 2 items diff --git a/pyproject.toml b/pyproject.toml index dd4be6c22d5..bead1ec7fef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,8 @@ filterwarnings = [ # produced by older pyparsing<=2.2.0. "default:Using or importing the ABCs:DeprecationWarning:pyparsing.*", "default:the imp module is deprecated in favour of importlib:DeprecationWarning:nose.*", + # distutils is deprecated in 3.10, scheduled for removal in 3.12 + "ignore:The distutils package is deprecated:DeprecationWarning", # produced by python3.6/site.py itself (3.6.7 on Travis, could not trigger it with 3.6.8)." "ignore:.*U.*mode is deprecated:DeprecationWarning:(?!(pytest|_pytest))", # produced by pytest-xdist @@ -40,6 +42,14 @@ filterwarnings = [ "default:invalid escape sequence:DeprecationWarning", # ignore use of unregistered marks, because we use many to test the implementation "ignore::_pytest.warning_types.PytestUnknownMarkWarning", + # https://github.com/benjaminp/six/issues/341 + "ignore:_SixMetaPathImporter\\.exec_module\\(\\) not found; falling back to load_module\\(\\):ImportWarning", + # https://github.com/benjaminp/six/pull/352 + "ignore:_SixMetaPathImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning", + # https://github.com/pypa/setuptools/pull/2517 + "ignore:VendorImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning", + # https://github.com/pytest-dev/execnet/pull/127 + "ignore:isSet\\(\\) is deprecated, use is_set\\(\\) instead:DeprecationWarning", ] pytester_example_dir = "testing/example_scripts" markers = [ diff --git a/scripts/release-on-comment.py b/scripts/release-on-comment.py index 44431a4fc3f..f2e8dfe904d 100644 --- a/scripts/release-on-comment.py +++ b/scripts/release-on-comment.py @@ -23,8 +23,8 @@ After that, it will create a release using the `release` tox environment, and push a new PR. -**Secret**: currently the secret is defined in the @pytestbot account, which the core maintainers -have access to. There we created a new secret named `chatops` with write access to the repository. +**Token**: currently the token from the GitHub Actions is used, pushed with +`pytest bot ` commit author. """ import argparse import json diff --git a/scripts/report-coverage.sh b/scripts/report-coverage.sh index fbcf20ca929..fa313f2fb7a 100755 --- a/scripts/report-coverage.sh +++ b/scripts/report-coverage.sh @@ -1,18 +1,30 @@ #!/usr/bin/env bash -set -e +set -euo pipefail set -x -if [ -z "$TOXENV" ]; then +# Install coverage. +if [[ -z ${TOXENV+x} || -z $TOXENV ]]; then python -m pip install coverage else # Add last TOXENV to $PATH. PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH" fi +# Run coverage. python -m coverage combine python -m coverage xml python -m coverage report -m + +# Download and verify latest Codecov bash uploader. # Set --connect-timeout to work around https://github.com/curl/curl/issues/4461 -curl -S -L --connect-timeout 5 --retry 6 -s https://codecov.io/bash -o codecov-upload.sh -bash codecov-upload.sh -Z -X fix -f coverage.xml "$@" +curl --silent --show-error --location --connect-timeout 5 --retry 6 -o codecov https://codecov.io/bash +VERSION=$(grep --only-matching 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2) +if command -v sha256sum; then + sha256sum --check --strict --ignore-missing --quiet <(curl --silent "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM") +else + shasum --algorithm 256 --check --strict --ignore-missing --quiet <(curl --silent "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM") +fi + +# Upload coverage. +bash codecov -Z -X fix -f coverage.xml "$@" diff --git a/setup.cfg b/setup.cfg index 14fdb6df5c0..dc546c8b1b3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,6 +21,7 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Topic :: Software Development :: Libraries Topic :: Software Development :: Testing Topic :: Utilities @@ -44,7 +45,7 @@ install_requires = attrs>=19.2.0 iniconfig packaging - pluggy>=0.12,<1.0.0a1 + pluggy>=0.12,<2.0 py>=1.8.2 toml atomicwrites>=1.0;sys_platform=="win32" @@ -54,7 +55,7 @@ python_requires = >=3.6 package_dir = =src setup_requires = - setuptools>=>=42.0 + setuptools>=42.0 setuptools-scm>=3.4 zip_safe = no diff --git a/src/_pytest/tmpdir.py b/src/_pytest/tmpdir.py index 3fe17583788..a6bd383a9cd 100644 --- a/src/_pytest/tmpdir.py +++ b/src/_pytest/tmpdir.py @@ -1,6 +1,7 @@ """Support for providing temporary directories to test functions.""" import os import re +import sys import tempfile from pathlib import Path from typing import Optional @@ -121,9 +122,9 @@ def getbasetemp(self) -> Path: # Also, to keep things private, fixup any world-readable temp # rootdir's permissions. Historically 0o755 was used, so we can't # just error out on this, at least for a while. - if hasattr(os, "getuid"): - rootdir_stat = rootdir.stat() + if sys.platform != "win32": uid = os.getuid() + rootdir_stat = rootdir.stat() # getuid shouldn't fail, but cpython defines such a case. # Let's hope for the best. if uid != -1: diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index b7ec18a9cb6..9196336c7a0 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1173,7 +1173,7 @@ def test_usage_error_code(pytester: Pytester) -> None: assert result.ret == ExitCode.USAGE_ERROR -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestUnhandledCoroutineWarning") def test_warn_on_async_function(pytester: Pytester) -> None: # In the below we .close() the coroutine only to avoid # "RuntimeWarning: coroutine 'test_2' was never awaited" @@ -1206,7 +1206,7 @@ def test_3(): ) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestUnhandledCoroutineWarning") def test_warn_on_async_gen_function(pytester: Pytester) -> None: pytester.makepyfile( test_async=""" diff --git a/testing/python/collect.py b/testing/python/collect.py index 4d5f4c6895f..c9d3dfc63c0 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -1210,7 +1210,7 @@ class Test(object): assert result.ret == ExitCode.NO_TESTS_COLLECTED -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestCollectionWarning") def test_dont_collect_non_function_callable(testdir): """Test for issue https://github.com/pytest-dev/pytest/issues/331 diff --git a/testing/test_collection.py b/testing/test_collection.py index 1138c2bd6f5..610180a9584 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -1212,7 +1212,7 @@ def test_collect_symlink_dir(pytester: Pytester) -> None: """A symlinked directory is collected.""" dir = pytester.mkdir("dir") dir.joinpath("test_it.py").write_text("def test_it(): pass", "utf-8") - pytester.path.joinpath("symlink_dir").symlink_to(dir) + symlink_or_skip(pytester.path.joinpath("symlink_dir"), dir) result = pytester.runpytest() result.assert_outcomes(passed=2) diff --git a/testing/test_config.py b/testing/test_config.py index b931797d429..06cec91134f 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -290,7 +290,7 @@ def test_silence_unknown_key_warning(self, pytester: Pytester) -> None: result = pytester.runpytest() result.stdout.no_fnmatch_line("*PytestConfigWarning*") - @pytest.mark.filterwarnings("default") + @pytest.mark.filterwarnings("default::pytest.PytestConfigWarning") def test_disable_warnings_plugin_disables_config_warnings( self, pytester: Pytester ) -> None: @@ -1780,7 +1780,7 @@ class DummyPlugin: ) def test_config_blocked_default_plugins(pytester: Pytester, plugin: str) -> None: if plugin == "debugging": - # Fixed in xdist master (after 1.27.0). + # Fixed in xdist (after 1.27.0). # https://github.com/pytest-dev/pytest-xdist/pull/422 try: import xdist # noqa: F401 diff --git a/testing/test_recwarn.py b/testing/test_recwarn.py index 91efe6d2393..4be33af37be 100644 --- a/testing/test_recwarn.py +++ b/testing/test_recwarn.py @@ -27,6 +27,17 @@ def test_method(recwarn): reprec.assertoutcome(passed=1) +@pytest.mark.filterwarnings("") +def test_recwarn_captures_deprecation_warning(recwarn: WarningsRecorder) -> None: + """ + Check that recwarn can capture DeprecationWarning by default + without custom filterwarnings (see #8666). + """ + warnings.warn(DeprecationWarning("some deprecation")) + assert len(recwarn) == 1 + assert recwarn.pop(DeprecationWarning) + + class TestWarningsRecorderChecker: def test_recording(self) -> None: rec = WarningsRecorder(_ispytest=True) diff --git a/testing/test_skipping.py b/testing/test_skipping.py index fc66eb18e64..3cb8bdff26e 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -1126,21 +1126,34 @@ def test_func(): pypy_version_info = getattr(sys, "pypy_version_info", None) if pypy_version_info is not None and pypy_version_info < (6,): markline = markline[5:] + elif sys.version_info[:2] >= (3, 10): + markline = markline[11:] elif sys.version_info >= (3, 8) or hasattr(sys, "pypy_version_info"): markline = markline[4:] - result.stdout.fnmatch_lines( - [ + + if sys.version_info[:2] >= (3, 10): + expected = [ "*ERROR*test_nameerror*", - "*evaluating*skipif*condition*", "*asd*", - "*ERROR*test_syntax*", - "*evaluating*xfail*condition*", - " syntax error", - markline, - "SyntaxError: invalid syntax", - "*1 pass*2 errors*", + "", + "During handling of the above exception, another exception occurred:", ] - ) + else: + expected = [ + "*ERROR*test_nameerror*", + ] + + expected += [ + "*evaluating*skipif*condition*", + "*asd*", + "*ERROR*test_syntax*", + "*evaluating*xfail*condition*", + " syntax error", + markline, + "SyntaxError: invalid syntax", + "*1 pass*2 errors*", + ] + result.stdout.fnmatch_lines(expected) def test_xfail_skipif_with_globals(pytester: Pytester) -> None: diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 5e833f40d43..fad6611d6e7 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1618,7 +1618,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus): ) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::UserWarning") def test_terminal_summary_warnings_are_displayed(pytester: Pytester) -> None: """Test that warnings emitted during pytest_terminal_summary are displayed. (#1305). @@ -1655,7 +1655,7 @@ def test_failure(): assert stdout.count("=== warnings summary ") == 2 -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::UserWarning") def test_terminal_summary_warnings_header_once(pytester: Pytester) -> None: pytester.makepyfile( """ diff --git a/testing/test_threadexception.py b/testing/test_threadexception.py index 399692bc963..5b7519f27d8 100644 --- a/testing/test_threadexception.py +++ b/testing/test_threadexception.py @@ -8,7 +8,7 @@ pytest.skip("threadexception plugin needs Python>=3.8", allow_module_level=True) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestUnhandledThreadExceptionWarning") def test_unhandled_thread_exception(pytester: Pytester) -> None: pytester.makepyfile( test_it=""" @@ -42,7 +42,7 @@ def test_2(): pass ) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestUnhandledThreadExceptionWarning") def test_unhandled_thread_exception_in_setup(pytester: Pytester) -> None: pytester.makepyfile( test_it=""" @@ -78,7 +78,7 @@ def test_2(): pass ) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestUnhandledThreadExceptionWarning") def test_unhandled_thread_exception_in_teardown(pytester: Pytester) -> None: pytester.makepyfile( test_it=""" diff --git a/testing/test_unraisableexception.py b/testing/test_unraisableexception.py index 32f89033409..f625833dcea 100644 --- a/testing/test_unraisableexception.py +++ b/testing/test_unraisableexception.py @@ -8,7 +8,7 @@ pytest.skip("unraisableexception plugin needs Python>=3.8", allow_module_level=True) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestUnraisableExceptionWarning") def test_unraisable(pytester: Pytester) -> None: pytester.makepyfile( test_it=""" @@ -40,7 +40,7 @@ def test_2(): pass ) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestUnraisableExceptionWarning") def test_unraisable_in_setup(pytester: Pytester) -> None: pytester.makepyfile( test_it=""" @@ -76,7 +76,7 @@ def test_2(): pass ) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestUnraisableExceptionWarning") def test_unraisable_in_teardown(pytester: Pytester) -> None: pytester.makepyfile( test_it=""" diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 66898041f08..655b1ae6194 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -38,7 +38,7 @@ def foo(): return str(test_file) -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::UserWarning", "default::RuntimeWarning") def test_normal_flow(testdir, pyfile_with_warnings): """Check that the warnings section is displayed.""" result = testdir.runpytest(pyfile_with_warnings) @@ -55,7 +55,7 @@ def test_normal_flow(testdir, pyfile_with_warnings): ) -@pytest.mark.filterwarnings("always") +@pytest.mark.filterwarnings("always::UserWarning") def test_setup_teardown_warnings(testdir): testdir.makepyfile( """ @@ -123,7 +123,7 @@ def test_ignore(testdir, pyfile_with_warnings, method): assert WARNINGS_SUMMARY_HEADER not in result.stdout.str() -@pytest.mark.filterwarnings("always") +@pytest.mark.filterwarnings("always::UserWarning") def test_unicode(testdir): testdir.makepyfile( """ @@ -182,7 +182,7 @@ def test_filterwarnings_mark(testdir, default_config): testdir.makeini( """ [pytest] - filterwarnings = always + filterwarnings = always::RuntimeWarning """ ) testdir.makepyfile( @@ -202,7 +202,9 @@ def test_show_warning(): warnings.warn(RuntimeWarning()) """ ) - result = testdir.runpytest("-W always" if default_config == "cmdline" else "") + result = testdir.runpytest( + "-W always::RuntimeWarning" if default_config == "cmdline" else "" + ) result.stdout.fnmatch_lines(["*= 1 failed, 2 passed, 1 warning in *"]) @@ -217,7 +219,7 @@ def test(): warnings.warn(UserWarning(1, 'foo')) """ ) - result = testdir.runpytest("-W", "always") + result = testdir.runpytest("-W", "always::UserWarning") result.stdout.fnmatch_lines(["*= 1 passed, 1 warning in *"]) @@ -236,7 +238,7 @@ def test_func(): assert result.ret == 0 -@pytest.mark.filterwarnings("always") +@pytest.mark.filterwarnings("always::UserWarning") def test_warning_captured_hook(testdir): testdir.makeconftest( """ @@ -297,7 +299,7 @@ def pytest_warning_recorded(self, warning_message, when, nodeid, location): assert collected_result[3] is None, str(collected) -@pytest.mark.filterwarnings("always") +@pytest.mark.filterwarnings("always::UserWarning") def test_collection_warnings(testdir): """Check that we also capture warnings issued during test collection (#3251).""" testdir.makepyfile( @@ -321,7 +323,7 @@ def test_foo(): ) -@pytest.mark.filterwarnings("always") +@pytest.mark.filterwarnings("always::UserWarning") def test_mark_regex_escape(testdir): """@pytest.mark.filterwarnings should not try to escape regex characters (#3936)""" testdir.makepyfile( @@ -337,7 +339,7 @@ def test_foo(): assert WARNINGS_SUMMARY_HEADER not in result.stdout.str() -@pytest.mark.filterwarnings("default") +@pytest.mark.filterwarnings("default::pytest.PytestWarning") @pytest.mark.parametrize("ignore_pytest_warnings", ["no", "ini", "cmdline"]) def test_hide_pytest_internal_warnings(testdir, ignore_pytest_warnings): """Make sure we can ignore internal pytest warnings using a warnings filter.""" @@ -383,7 +385,7 @@ def test_option_precedence_cmdline_over_ini(testdir, ignore_on_cmdline): testdir.makeini( """ [pytest] - filterwarnings = error + filterwarnings = error::UserWarning """ ) testdir.makepyfile( @@ -578,7 +580,7 @@ def test_warnings_checker_twice(): @pytest.mark.filterwarnings("ignore::pytest.PytestExperimentalApiWarning") -@pytest.mark.filterwarnings("always") +@pytest.mark.filterwarnings("always::UserWarning") def test_group_warnings_by_message(testdir): testdir.copy_example("warnings/test_group_warnings_by_message.py") result = testdir.runpytest() @@ -610,7 +612,7 @@ def test_group_warnings_by_message(testdir): @pytest.mark.filterwarnings("ignore::pytest.PytestExperimentalApiWarning") -@pytest.mark.filterwarnings("always") +@pytest.mark.filterwarnings("always::UserWarning") def test_group_warnings_by_message_summary(testdir): testdir.copy_example("warnings/test_group_warnings_by_message_summary") testdir.syspathinsert() diff --git a/tox.ini b/tox.ini index f0cfaa460fb..db099cbfd58 100644 --- a/tox.ini +++ b/tox.ini @@ -9,8 +9,9 @@ envlist = py37 py38 py39 + py310 pypy3 - py37-{pexpect,xdist,unittestextras,numpy,pluggymaster} + py37-{pexpect,xdist,unittestextras,numpy,pluggymain} doctesting plugins py37-freeze @@ -46,7 +47,7 @@ deps = doctesting: PyYAML numpy: numpy>=1.19.4 pexpect: pexpect>=4.8.0 - pluggymaster: git+https://github.com/pytest-dev/pluggy.git@master + pluggymain: pluggy @ git+https://github.com/pytest-dev/pluggy.git pygments>=2.7.2 unittestextras: twisted unittestextras: asynctest