Compare commits
25 Commits
update-plu
...
7.0.0.dev0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
109312ba86 | ||
|
|
2623ee2e0e | ||
|
|
ba1ad7d517 | ||
|
|
c4c3b6d4fd | ||
|
|
e729e0d1e6 | ||
|
|
c19f63d39d | ||
|
|
51742e14a1 | ||
|
|
6573107b97 | ||
|
|
ef395e1c38 | ||
|
|
f0e5640497 | ||
|
|
cb1dba0489 | ||
|
|
0d6cb3b281 | ||
|
|
d7b0e17205 | ||
|
|
942789bace | ||
|
|
f573b56bb6 | ||
|
|
e44300de7e | ||
|
|
8eb8c42bd6 | ||
|
|
ac10fe0679 | ||
|
|
0a6a1fa225 | ||
|
|
d2886b8d23 | ||
|
|
68b329dda8 | ||
|
|
ab3cd644dc | ||
|
|
a1967e9594 | ||
|
|
c4da6fff42 | ||
|
|
605fe29d12 |
8
.github/workflows/prepare-release-pr.yml
vendored
8
.github/workflows/prepare-release-pr.yml
vendored
@@ -11,6 +11,10 @@ on:
|
||||
description: 'Major release? (yes/no)'
|
||||
required: true
|
||||
default: 'no'
|
||||
prerelease:
|
||||
description: 'Prerelease (ex: rc1). Leave empty if not a pre-release.'
|
||||
required: true
|
||||
default: ''
|
||||
|
||||
# Set permissions at the job level.
|
||||
permissions: {}
|
||||
@@ -41,9 +45,9 @@ jobs:
|
||||
- name: Prepare release PR (minor/patch release)
|
||||
if: github.event.inputs.major == 'no'
|
||||
run: |
|
||||
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }}
|
||||
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --prerelease '${{ github.event.inputs.prerelease }}'
|
||||
|
||||
- name: Prepare release PR (major release)
|
||||
if: github.event.inputs.major == 'yes'
|
||||
run: |
|
||||
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major
|
||||
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major --prerelease '${{ github.event.inputs.prerelease }}'
|
||||
|
||||
40
.github/workflows/release-on-comment.yml
vendored
40
.github/workflows/release-on-comment.yml
vendored
@@ -1,40 +0,0 @@
|
||||
# part of our release process, see `release-on-comment.py`
|
||||
name: release on comment
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
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'))
|
||||
|
||||
steps:
|
||||
- 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 ${{ github.token }}
|
||||
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 21.5b2
|
||||
rev: 21.6b0
|
||||
hooks:
|
||||
- id: black
|
||||
args: [--safe, --quiet]
|
||||
@@ -34,7 +34,7 @@ repos:
|
||||
- id: reorder-python-imports
|
||||
args: ['--application-directories=.:src', --py36-plus]
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.19.1
|
||||
rev: v2.19.4
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py36-plus]
|
||||
@@ -44,11 +44,11 @@ repos:
|
||||
- id: setup-cfg-fmt
|
||||
args: [--max-py-version=3.10]
|
||||
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||
rev: v1.8.0
|
||||
rev: v1.9.0
|
||||
hooks:
|
||||
- id: python-use-type-annotations
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.812
|
||||
rev: v0.902
|
||||
hooks:
|
||||
- id: mypy
|
||||
files: ^(src/|testing/)
|
||||
@@ -58,6 +58,8 @@ repos:
|
||||
- py>=1.8.2
|
||||
- attrs>=19.2.0
|
||||
- packaging
|
||||
- types-toml
|
||||
- types-pkg_resources
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: rst
|
||||
|
||||
1
AUTHORS
1
AUTHORS
@@ -144,6 +144,7 @@ Iwan Briquemont
|
||||
Jaap Broekhuizen
|
||||
Jakob van Santen
|
||||
Jakub Mitoraj
|
||||
James Bourbeau
|
||||
Jan Balster
|
||||
Janne Vanhala
|
||||
Jason R. Coombs
|
||||
|
||||
@@ -14,60 +14,90 @@ Preparing: Automatic Method
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We have developed an automated workflow for releases, that uses GitHub workflows and is triggered
|
||||
by opening an issue.
|
||||
by `manually running <https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow>`__
|
||||
the `prepare-release-pr workflow <https://github.com/pytest-dev/pytest/actions/workflows/prepare-release-pr.yml>`__
|
||||
on GitHub Actions.
|
||||
|
||||
Bug-fix releases
|
||||
^^^^^^^^^^^^^^^^
|
||||
The automation will decide the new version number based on the following criteria:
|
||||
|
||||
A bug-fix release is always done from a maintenance branch, so for example to release bug-fix
|
||||
``5.1.2``, open a new issue and add this comment to the body::
|
||||
- If the "major release" input is set to "yes", release a new major release
|
||||
(e.g. 7.0.0 -> 8.0.0)
|
||||
- If there are any ``.feature.rst`` or ``.breaking.rst`` files in the
|
||||
``changelog`` directory, release a new minor release (e.g. 7.0.0 -> 7.1.0)
|
||||
- Otherwise, release a bugfix release (e.g. 7.0.0 -> 7.0.1)
|
||||
- If the "prerelease" input is set, append the string to the version number
|
||||
(e.g. 7.0.0 -> 8.0.0rc1), if "major" is set, and "prerelease" is set to `rc1`)
|
||||
|
||||
@pytestbot please prepare release from 5.1.x
|
||||
Bug-fix and minor releases
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Where ``5.1.x`` is the maintenance branch for the ``5.1`` series.
|
||||
Bug-fix and minor releases are always done from a maintenance branch. First,
|
||||
consider double-checking the ``changelog`` directory to see if there are any
|
||||
breaking changes or new features.
|
||||
|
||||
The automated workflow will publish a PR for a branch ``release-5.1.2``
|
||||
and notify it as a comment in the issue.
|
||||
For a new minor release, first create a new maintenance branch from ``main``::
|
||||
|
||||
Minor releases
|
||||
git fetch --all
|
||||
git branch 7.1.x upstream/main
|
||||
git push upstream 7.1.x
|
||||
|
||||
Then, trigger the workflow with the following inputs:
|
||||
|
||||
- branch: **7.1.x**
|
||||
- major release: **no**
|
||||
- prerelease: empty
|
||||
|
||||
Or via the commandline using `GitHub's cli <https://github.com/cli/cli>`__::
|
||||
|
||||
gh workflow run prepare-release-pr.yml -f branch=7.1.x -f major=no -f prerelease=
|
||||
|
||||
Where ``7.1.x`` is the maintenance branch for the ``7.1`` series. The automated
|
||||
workflow will publish a PR for a branch ``release-7.1.0``.
|
||||
|
||||
Similarly, for a bug-fix release, use the existing maintenance branch and
|
||||
trigger the workflow with e.g. ``branch: 7.0.x`` to get a new ``release-7.0.1``
|
||||
PR.
|
||||
|
||||
Major releases
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
1. Create a new maintenance branch from ``main``::
|
||||
|
||||
git fetch --all
|
||||
git branch 5.2.x upstream/main
|
||||
git push upstream 5.2.x
|
||||
git branch 8.0.x upstream/main
|
||||
git push upstream 8.0.x
|
||||
|
||||
2. Open a new issue and add this comment to the body::
|
||||
2. Trigger the workflow with the following inputs:
|
||||
|
||||
@pytestbot please prepare release from 5.2.x
|
||||
- branch: **8.0.x**
|
||||
- major release: **yes**
|
||||
- prerelease: empty
|
||||
|
||||
The automated workflow will publish a PR for a branch ``release-5.2.0`` and
|
||||
notify it as a comment in the issue.
|
||||
Or via the commandline::
|
||||
|
||||
Major and release candidates
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
gh workflow run prepare-release-pr.yml -f branch=8.0.x -f major=yes -f prerelease=
|
||||
|
||||
1. Create a new maintenance branch from ``main``::
|
||||
|
||||
git fetch --all
|
||||
git branch 6.0.x upstream/main
|
||||
git push upstream 6.0.x
|
||||
|
||||
2. For a **major release**, open a new issue and add this comment in the body::
|
||||
|
||||
@pytestbot please prepare major release from 6.0.x
|
||||
|
||||
For a **release candidate**, the comment must be (TODO: `#7551 <https://github.com/pytest-dev/pytest/issues/7551>`__)::
|
||||
|
||||
@pytestbot please prepare release candidate from 6.0.x
|
||||
|
||||
The automated workflow will publish a PR for a branch ``release-6.0.0`` and
|
||||
notify it as a comment in the issue.
|
||||
The automated workflow will publish a PR for a branch ``release-8.0.0``.
|
||||
|
||||
At this point on, this follows the same workflow as other maintenance branches: bug-fixes are merged
|
||||
into ``main`` and ported back to the maintenance branch, even for release candidates.
|
||||
|
||||
Release candidates
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
To release a release candidate, set the "prerelease" input to the version number
|
||||
suffix to use. To release a ``8.0.0rc1``, proceed like under "major releases", but set:
|
||||
|
||||
- branch: 8.0.x
|
||||
- major release: yes
|
||||
- prerelease: **rc1**
|
||||
|
||||
Or via the commandline::
|
||||
|
||||
gh workflow run prepare-release-pr.yml -f branch=8.0.x -f major=yes -f prerelease=rc1
|
||||
|
||||
The automated workflow will publish a PR for a branch ``release-8.0.0rc1``.
|
||||
|
||||
**A note about release candidates**
|
||||
|
||||
During release candidates we can merge small improvements into
|
||||
|
||||
1
changelog/8246.breaking.rst
Normal file
1
changelog/8246.breaking.rst
Normal file
@@ -0,0 +1 @@
|
||||
``--version`` now writes version information to ``stdout`` rather than ``stderr``.
|
||||
4
changelog/8447.deprecation.rst
Normal file
4
changelog/8447.deprecation.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
Defining a custom pytest node type which is both an item and a collector now issues a warning.
|
||||
It was never sanely supported and triggers hard to debug errors.
|
||||
|
||||
Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example.
|
||||
@@ -95,6 +95,7 @@ Further topics
|
||||
license
|
||||
contact
|
||||
|
||||
history
|
||||
historical-notes
|
||||
talks
|
||||
projects
|
||||
|
||||
@@ -42,6 +42,20 @@ As pytest tries to move off `py.path.local <https://py.readthedocs.io/en/latest/
|
||||
|
||||
Pytest will provide compatibility for quite a while.
|
||||
|
||||
Diamond inheritance between :class:`pytest.File` and :class:`pytest.Item`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 6.3
|
||||
|
||||
Inheriting from both Item and file at once has never been supported officially,
|
||||
however some plugins providing linting/code analysis have been using this as a hack.
|
||||
|
||||
This practice is now officially deprecated and a common way to fix this is `example pr fixing inheritance`_.
|
||||
|
||||
|
||||
|
||||
.. _example pr fixing inheritance: https://github.com/asmeurer/pytest-flakes/pull/40/files
|
||||
|
||||
|
||||
Backward compatibilities in ``Parser.addoption``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
147
doc/en/history.rst
Normal file
147
doc/en/history.rst
Normal file
@@ -0,0 +1,147 @@
|
||||
History
|
||||
=======
|
||||
|
||||
pytest has a long and interesting history. The `first commit
|
||||
<https://github.com/pytest-dev/pytest/commit/5992a8ef21424d7571305a8d7e2a3431ee7e1e23>`__
|
||||
in this repository is from January 2007, and even that commit alone already
|
||||
tells a lot: The repository originally was from the `py
|
||||
<https://pypi.org/project/py/>`__ library (later split off to pytest), and it
|
||||
originally was a SVN revision, migrated to Mercurial, and finally migrated to
|
||||
git.
|
||||
|
||||
However, the commit says “create the new development trunk” and is
|
||||
already quite big: *435 files changed, 58640 insertions(+)*. This is because
|
||||
pytest originally was born as part of `PyPy <https://www.pypy.org/>`__, to make
|
||||
it easier to write tests for it. Here's how it evolved from there to its own
|
||||
project:
|
||||
|
||||
|
||||
- Late 2002 / early 2003, `PyPy was
|
||||
born <https://morepypy.blogspot.com/2018/09/the-first-15-years-of-pypy.html>`__.
|
||||
- Like that blog post mentioned, from very early on, there was a big
|
||||
focus on testing. There were various ``testsupport`` files on top of
|
||||
unittest.py, and as early as June 2003, Holger Krekel (`@hpk42 <https://github.com/hpk42>`__)
|
||||
`refactored <https://mail.python.org/pipermail/pypy-dev/2003-June/000787.html>`__
|
||||
its test framework to clean things up (``pypy.tool.test``, but still
|
||||
on top of ``unittest.py``, with nothing pytest-like yet).
|
||||
- In December 2003, there was `another
|
||||
iteration <https://foss.heptapod.net/pypy/pypy/-/commit/02752373e1b29d89c6bb0a97e5f940caa22bdd63>`__
|
||||
at improving their testing situation, by Stefan Schwarzer, called
|
||||
``pypy.tool.newtest``.
|
||||
- However, it didn’t seem to be around for long, as around June/July
|
||||
2004, efforts started on a thing called ``utest``, offering plain
|
||||
assertions. This seems like the start of something pytest-like, but
|
||||
unfortunately, it's unclear where the test runner's code was at the time.
|
||||
The closest thing still around is `this
|
||||
file <https://foss.heptapod.net/pypy/pypy/-/commit/0735f9ed287ec20950a7dd0a16fc10810d4f6847>`__,
|
||||
but that doesn’t seem like a complete test runner at all. What can be seen
|
||||
is that there were `various
|
||||
efforts <https://foss.heptapod.net/pypy/pypy/-/commits/branch/default?utf8=%E2%9C%93&search=utest>`__
|
||||
by Laura Creighton and Samuele Pedroni (`@pedronis <https://github.com/pedronis>`__) at automatically
|
||||
converting existing tests to the new ``utest`` framework.
|
||||
- Around the same time, for Europython 2004, @hpk42 `started a
|
||||
project <http://web.archive.org/web/20041020215353/http://codespeak.net/svn/user/hpk/talks/std-talk.txt>`__
|
||||
originally called “std”, intended to be a “complementary standard
|
||||
library” - already laying out the principles behind what later became
|
||||
pytest:
|
||||
|
||||
- current “batteries included” are very useful, but
|
||||
|
||||
- some of them are written in a pretty much java-like style,
|
||||
especially the unittest-framework
|
||||
- […]
|
||||
- the best API is one that doesn’t exist
|
||||
|
||||
[…]
|
||||
|
||||
- a testing package should require as few boilerplate code as
|
||||
possible and offer much flexibility
|
||||
- it should provide premium quality tracebacks and debugging aid
|
||||
|
||||
[…]
|
||||
|
||||
- first of all … forget about limited “assertXYZ APIs” and use the
|
||||
real thing, e.g.::
|
||||
|
||||
assert x == y
|
||||
|
||||
- this works with plain python but you get unhelpful “assertion
|
||||
failed” errors with no information
|
||||
|
||||
- std.utest (magic!) actually reinterprets the assertion expression
|
||||
and offers detailed information about underlying values
|
||||
|
||||
- In September 2004, the ``py-dev`` mailinglist gets born, which `is
|
||||
now <https://mail.python.org/pipermail/pytest-dev/>`__ ``pytest-dev``,
|
||||
but thankfully with all the original archives still intact.
|
||||
|
||||
- Around September/October 2004, the ``std`` project `was renamed
|
||||
<https://mail.python.org/pipermail/pypy-dev/2004-September/001565.html>`__ to
|
||||
``py`` and ``std.utest`` became ``py.test``. This is also the first time the
|
||||
`entire source
|
||||
code <https://foss.heptapod.net/pypy/pypy/-/commit/42cf50c412026028e20acd23d518bd92e623ac11>`__,
|
||||
seems to be available, with much of the API still being around today:
|
||||
|
||||
- ``py.path.local``, which is being phased out of pytest (in favour of
|
||||
pathlib) some 16-17 years later
|
||||
- The idea of the collection tree, including ``Collector``,
|
||||
``FSCollector``, ``Directory``, ``PyCollector``, ``Module``,
|
||||
``Class``
|
||||
- Arguments like ``-x`` / ``--exitfirst``, ``-l`` /
|
||||
``--showlocals``, ``--fulltrace``, ``--pdb``, ``-S`` /
|
||||
``--nocapture`` (``-s`` / ``--capture=off`` today),
|
||||
``--collectonly`` (``--collect-only`` today)
|
||||
|
||||
- In the same month, the ``py`` library `gets split off
|
||||
<https://foss.heptapod.net/pypy/pypy/-/commit/6bdafe9203ad92eb259270b267189141c53bce33>`__
|
||||
from ``PyPy``
|
||||
|
||||
- It seemed to get rather quiet for a while, and little seemed to happen
|
||||
between October 2004 (removing ``py`` from PyPy) and January
|
||||
2007 (first commit in the now-pytest repository). However, there were
|
||||
various discussions about features/ideas on the mailinglist, and `a
|
||||
couple of
|
||||
releases <https://pypi.org/project/py/0.8.0-alpha2/#history>`__ every
|
||||
couple of months:
|
||||
|
||||
- March 2006: py 0.8.0-alpha2
|
||||
- May 2007: py 0.9.0
|
||||
- March 2008: py 0.9.1 (first release to be found `in the pytest
|
||||
changelog <https://github.com/pytest-dev/pytest/blob/main/doc/en/changelog.rst#091>`__!)
|
||||
- August 2008: py 0.9.2
|
||||
|
||||
- In August 2009, py 1.0.0 was released, `introducing a lot of
|
||||
fundamental
|
||||
features <https://holgerkrekel.net/2009/08/04/pylib-1-0-0-released-the-testing-with-python-innovations-continue/>`__:
|
||||
|
||||
- funcargs/fixtures
|
||||
- A `plugin
|
||||
architecture <http://web.archive.org/web/20090629032718/https://codespeak.net/py/dist/test/extend.html>`__
|
||||
which still looks very much the same today!
|
||||
- Various `default
|
||||
plugins <http://web.archive.org/web/20091005181132/https://codespeak.net/py/dist/test/plugin/index.html>`__,
|
||||
including
|
||||
`monkeypatch <http://web.archive.org/web/20091012022829/http://codespeak.net/py/dist/test/plugin/monkeypatch.html>`__
|
||||
|
||||
- Even back there, the
|
||||
`FAQ <http://web.archive.org/web/20091005222413/http://codespeak.net/py/dist/faq.html>`__
|
||||
said:
|
||||
|
||||
Clearly, [a second standard library] was ambitious and the naming has
|
||||
maybe haunted the project rather than helping it. There may be a
|
||||
project name change and possibly a split up into different projects
|
||||
sometime.
|
||||
|
||||
and that finally happened in November 2010, when pytest 2.0.0 `was
|
||||
released <https://mail.python.org/pipermail/pytest-dev/2010-November/001687.html>`__
|
||||
as a package separate from ``py`` (but still called ``py.test``).
|
||||
|
||||
- In August 2016, pytest 3.0.0 `was
|
||||
released <https://docs.pytest.org/en/latest/changelog.html#id1313>`__,
|
||||
which adds ``pytest`` (rather than ``py.test``) as the recommended
|
||||
command-line entry point
|
||||
|
||||
Due to this history, it's diffcult to answer the question when pytest was started.
|
||||
It depends what point should really be seen as the start of it all. One
|
||||
possible interpretation is to pick Europython 2004, i.e. around June/July
|
||||
2004.
|
||||
@@ -244,7 +244,7 @@ Asserting warnings with the warns function
|
||||
|
||||
|
||||
|
||||
You can check that code raises a particular warning using func:`pytest.warns`,
|
||||
You can check that code raises a particular warning using :func:`pytest.warns`,
|
||||
which works in a similar manner to :ref:`raises <assertraises>`:
|
||||
|
||||
.. code-block:: python
|
||||
@@ -272,7 +272,7 @@ argument ``match`` to assert that the exception matches a text or regex::
|
||||
...
|
||||
Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted...
|
||||
|
||||
You can also call func:`pytest.warns` on a function or code string:
|
||||
You can also call :func:`pytest.warns` on a function or code string:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -307,10 +307,10 @@ filter at the end of the test, so no global state is leaked.
|
||||
Recording warnings
|
||||
------------------
|
||||
|
||||
You can record raised warnings either using func:`pytest.warns` or with
|
||||
You can record raised warnings either using :func:`pytest.warns` or with
|
||||
the ``recwarn`` fixture.
|
||||
|
||||
To record with func:`pytest.warns` without asserting anything about the warnings,
|
||||
To record with :func:`pytest.warns` without asserting anything about the warnings,
|
||||
pass no arguments as the expected warning type and it will default to a generic Warning:
|
||||
|
||||
.. code-block:: python
|
||||
@@ -339,7 +339,7 @@ The ``recwarn`` fixture will record warnings for the whole function:
|
||||
assert w.filename
|
||||
assert w.lineno
|
||||
|
||||
Both ``recwarn`` and func:`pytest.warns` return the same interface for recorded
|
||||
Both ``recwarn`` and :func:`pytest.warns` return the same interface for recorded
|
||||
warnings: a WarningsRecorder instance. To view the recorded warnings, you can
|
||||
iterate over this instance, call ``len`` on it to get the number of recorded
|
||||
warnings, or index into it to get a particular recorded warning.
|
||||
|
||||
@@ -369,9 +369,12 @@ Here is a simple test file with the several usages:
|
||||
|
||||
Running it with the report-on-xfail option gives this output:
|
||||
|
||||
.. FIXME: Use $ instead of ! again to reenable regendoc once it's fixed:
|
||||
https://github.com/pytest-dev/pytest/issues/8807
|
||||
|
||||
.. code-block:: pytest
|
||||
|
||||
example $ pytest -rx xfail_demo.py
|
||||
! 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
|
||||
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||
|
||||
@@ -168,15 +168,15 @@ You can invoke ``pytest`` from Python code directly:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
pytest.main()
|
||||
retcode = pytest.main()
|
||||
|
||||
this acts as if you would call "pytest" from the command line.
|
||||
It will not raise ``SystemExit`` but return the exitcode instead.
|
||||
It will not raise :class:`SystemExit` but return the :ref:`exit code <exit-codes>` instead.
|
||||
You can pass in options and arguments:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
pytest.main(["-x", "mytestdir"])
|
||||
retcode = pytest.main(["-x", "mytestdir"])
|
||||
|
||||
You can specify additional plugins to ``pytest.main``:
|
||||
|
||||
@@ -191,7 +191,8 @@ You can specify additional plugins to ``pytest.main``:
|
||||
print("*** test run reporting finishing")
|
||||
|
||||
|
||||
pytest.main(["-qq"], plugins=[MyPlugin()])
|
||||
if __name__ == "__main__":
|
||||
sys.exit(pytest.main(["-qq"], plugins=[MyPlugin()]))
|
||||
|
||||
Running it will show that ``MyPlugin`` was added and its
|
||||
hook was invoked:
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
:orphan:
|
||||
|
||||
..
|
||||
(note: please leave this here, next open training to follow soon)
|
||||
.. sidebar:: Next Open Trainings
|
||||
.. sidebar:: Next Open Trainings
|
||||
|
||||
- `Professionelles Testen für Python mit pytest <https://www.enterpy.de/lecture_compact1.php?id=12713>`_ (German), part of the enterPy conference, April 22nd (sold out) and May 20th, remote.
|
||||
- `Introduction to pytest <https://ep2021.europython.eu/talks/7S5Cnc6-introduction-to-pytest/>`_, part of `Europython 2021 <https://ep2021.europython.eu/>`_, July 27th, remote.
|
||||
- `pytest: Professionelles Testen (nicht nur) für Python <https://workshoptage.ch/workshops/2021/pytest-test-driven-development-nicht-nur-fuer-python-2/>`_ (German), part of `CH-Open Workshoptage <https://workshoptage.ch/>`_, September 9th, ETH Zurich, Switzerland.
|
||||
- `Professional Testing with Python <https://www.python-academy.com/courses/specialtopics/python_course_testing.html>`_, via `Python Academy <https://www.python-academy.com/>`_, Q4/2021 (TBD, 3 days), Leipzig (Germany) and remote.
|
||||
|
||||
Also see `previous talks and blogposts <talks.html>`_.
|
||||
Also see `previous talks and blogposts <talks.html>`_.
|
||||
|
||||
.. _features:
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Plugin List
|
||||
|
||||
PyPI projects that match "pytest-\*" are considered plugins and are listed
|
||||
automatically. Packages classified as inactive are excluded.
|
||||
This list contains 880 plugins.
|
||||
This list contains 887 plugins.
|
||||
|
||||
============================================================================================================== ======================================================================================================================================================================== ============== ===================== ================================================
|
||||
name summary last release status requires
|
||||
@@ -42,18 +42,19 @@ name
|
||||
`pytest-appengine <https://pypi.org/project/pytest-appengine/>`_ AppEngine integration that works well with pytest-django Feb 27, 2017 N/A N/A
|
||||
`pytest-appium <https://pypi.org/project/pytest-appium/>`_ Pytest plugin for appium Dec 05, 2019 N/A N/A
|
||||
`pytest-approvaltests <https://pypi.org/project/pytest-approvaltests/>`_ A plugin to use approvaltests with pytest Feb 07, 2021 4 - Beta pytest (>=3.5.0)
|
||||
`pytest-argus <https://pypi.org/project/pytest-argus/>`_ pyest results colection plugin Jun 24, 2021 5 - Production/Stable pytest (>=6.2.4)
|
||||
`pytest-arraydiff <https://pypi.org/project/pytest-arraydiff/>`_ pytest plugin to help with comparing array output from tests Dec 06, 2018 4 - Beta pytest
|
||||
`pytest-asgi-server <https://pypi.org/project/pytest-asgi-server/>`_ Convenient ASGI client/server fixtures for Pytest Dec 12, 2020 N/A pytest (>=5.4.1)
|
||||
`pytest-asptest <https://pypi.org/project/pytest-asptest/>`_ test Answer Set Programming programs Apr 28, 2018 4 - Beta N/A
|
||||
`pytest-assertutil <https://pypi.org/project/pytest-assertutil/>`_ pytest-assertutil May 10, 2019 N/A N/A
|
||||
`pytest-assert-utils <https://pypi.org/project/pytest-assert-utils/>`_ Useful assertion utilities for use with pytest Mar 28, 2021 3 - Alpha N/A
|
||||
`pytest-assume <https://pypi.org/project/pytest-assume/>`_ A pytest plugin that allows multiple failures per test Dec 08, 2020 N/A pytest (>=2.7)
|
||||
`pytest-assume <https://pypi.org/project/pytest-assume/>`_ A pytest plugin that allows multiple failures per test Jun 24, 2021 N/A pytest (>=2.7)
|
||||
`pytest-ast-back-to-python <https://pypi.org/project/pytest-ast-back-to-python/>`_ A plugin for pytest devs to view how assertion rewriting recodes the AST Sep 29, 2019 4 - Beta N/A
|
||||
`pytest-astropy <https://pypi.org/project/pytest-astropy/>`_ Meta-package containing dependencies for testing Jan 16, 2020 5 - Production/Stable pytest (>=4.6)
|
||||
`pytest-astropy-header <https://pypi.org/project/pytest-astropy-header/>`_ pytest plugin to add diagnostic information to the header of the test output Dec 18, 2019 3 - Alpha pytest (>=2.8)
|
||||
`pytest-ast-transformer <https://pypi.org/project/pytest-ast-transformer/>`_ May 04, 2019 3 - Alpha pytest
|
||||
`pytest-asyncio <https://pypi.org/project/pytest-asyncio/>`_ Pytest support for asyncio. Apr 21, 2021 4 - Beta pytest (>=5.4.0)
|
||||
`pytest-asyncio-cooperative <https://pypi.org/project/pytest-asyncio-cooperative/>`_ Run all your asynchronous tests cooperatively. Apr 17, 2021 4 - Beta N/A
|
||||
`pytest-asyncio-cooperative <https://pypi.org/project/pytest-asyncio-cooperative/>`_ Run all your asynchronous tests cooperatively. Jun 25, 2021 4 - Beta N/A
|
||||
`pytest-asyncio-network-simulator <https://pypi.org/project/pytest-asyncio-network-simulator/>`_ pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2)
|
||||
`pytest-async-mongodb <https://pypi.org/project/pytest-async-mongodb/>`_ pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2)
|
||||
`pytest-async-sqlalchemy <https://pypi.org/project/pytest-async-sqlalchemy/>`_ Database testing fixtures using the SQLAlchemy asyncio API Jun 11, 2021 4 - Beta pytest (>=6.0.0)
|
||||
@@ -222,7 +223,7 @@ name
|
||||
`pytest-django-testing-postgresql <https://pypi.org/project/pytest-django-testing-postgresql/>`_ Use a temporary PostgreSQL database with pytest-django Dec 05, 2019 3 - Alpha N/A
|
||||
`pytest-doc <https://pypi.org/project/pytest-doc/>`_ A documentation plugin for py.test. Jun 28, 2015 5 - Production/Stable N/A
|
||||
`pytest-docgen <https://pypi.org/project/pytest-docgen/>`_ An RST Documentation Generator for pytest-based test suites Apr 17, 2020 N/A N/A
|
||||
`pytest-docker <https://pypi.org/project/pytest-docker/>`_ Simple pytest fixtures for Docker and docker-compose based tests Sep 22, 2020 N/A pytest (<7.0,>=4.0)
|
||||
`pytest-docker <https://pypi.org/project/pytest-docker/>`_ Simple pytest fixtures for Docker and docker-compose based tests Jun 14, 2021 N/A pytest (<7.0,>=4.0)
|
||||
`pytest-docker-butla <https://pypi.org/project/pytest-docker-butla/>`_ Jun 16, 2019 3 - Alpha N/A
|
||||
`pytest-dockerc <https://pypi.org/project/pytest-dockerc/>`_ Run, manage and stop Docker Compose project from Docker API Oct 09, 2020 5 - Production/Stable pytest (>=3.0)
|
||||
`pytest-docker-compose <https://pypi.org/project/pytest-docker-compose/>`_ Manages Docker containers during your integration tests Jan 26, 2021 5 - Production/Stable pytest (>=3.3)
|
||||
@@ -248,6 +249,7 @@ name
|
||||
`pytest-drivings <https://pypi.org/project/pytest-drivings/>`_ Tool to allow webdriver automation to be ran locally or remotely Jan 13, 2021 N/A N/A
|
||||
`pytest-drop-dup-tests <https://pypi.org/project/pytest-drop-dup-tests/>`_ A Pytest plugin to drop duplicated tests during collection May 23, 2020 4 - Beta pytest (>=2.7)
|
||||
`pytest-dump2json <https://pypi.org/project/pytest-dump2json/>`_ A pytest plugin for dumping test results to json. Jun 29, 2015 N/A N/A
|
||||
`pytest-duration-insights <https://pypi.org/project/pytest-duration-insights/>`_ Jun 25, 2021 N/A N/A
|
||||
`pytest-dynamicrerun <https://pypi.org/project/pytest-dynamicrerun/>`_ A pytest plugin to rerun tests dynamically based off of test outcome and output. Aug 15, 2020 4 - Beta N/A
|
||||
`pytest-dynamodb <https://pypi.org/project/pytest-dynamodb/>`_ DynamoDB fixtures for pytest Jun 03, 2021 5 - Production/Stable pytest
|
||||
`pytest-easy-addoption <https://pypi.org/project/pytest-easy-addoption/>`_ pytest-easy-addoption: Easy way to work with pytest addoption Jan 22, 2020 N/A N/A
|
||||
@@ -261,11 +263,11 @@ name
|
||||
`pytest-elements <https://pypi.org/project/pytest-elements/>`_ Tool to help automate user interfaces Jan 13, 2021 N/A pytest (>=5.4,<6.0)
|
||||
`pytest-elk-reporter <https://pypi.org/project/pytest-elk-reporter/>`_ A simple plugin to use with pytest Jan 24, 2021 4 - Beta pytest (>=3.5.0)
|
||||
`pytest-email <https://pypi.org/project/pytest-email/>`_ Send execution result email Jul 08, 2020 N/A pytest
|
||||
`pytest-embedded <https://pypi.org/project/pytest-embedded/>`_ pytest embedded plugin Jun 11, 2021 N/A pytest (>=6.2.0)
|
||||
`pytest-embedded-idf <https://pypi.org/project/pytest-embedded-idf/>`_ pytest embedded plugin for esp-idf project Jun 11, 2021 N/A N/A
|
||||
`pytest-embedded-qemu-idf <https://pypi.org/project/pytest-embedded-qemu-idf/>`_ pytest embedded plugin for esp-idf project by qemu, not target chip Jun 11, 2021 N/A N/A
|
||||
`pytest-embedded-serial <https://pypi.org/project/pytest-embedded-serial/>`_ pytest embedded plugin for testing serial ports Jun 11, 2021 N/A N/A
|
||||
`pytest-embedded-serial-esp <https://pypi.org/project/pytest-embedded-serial-esp/>`_ pytest embedded plugin for testing espressif boards via serial ports Jun 11, 2021 N/A N/A
|
||||
`pytest-embedded <https://pypi.org/project/pytest-embedded/>`_ pytest embedded plugin Jun 16, 2021 N/A pytest (>=6.2.0)
|
||||
`pytest-embedded-idf <https://pypi.org/project/pytest-embedded-idf/>`_ pytest embedded plugin for esp-idf project Jun 16, 2021 N/A N/A
|
||||
`pytest-embedded-qemu-idf <https://pypi.org/project/pytest-embedded-qemu-idf/>`_ pytest embedded plugin for esp-idf project by qemu, not target chip Jun 16, 2021 N/A N/A
|
||||
`pytest-embedded-serial <https://pypi.org/project/pytest-embedded-serial/>`_ pytest embedded plugin for testing serial ports Jun 16, 2021 N/A N/A
|
||||
`pytest-embedded-serial-esp <https://pypi.org/project/pytest-embedded-serial-esp/>`_ pytest embedded plugin for testing espressif boards via serial ports Jun 16, 2021 N/A N/A
|
||||
`pytest-emoji <https://pypi.org/project/pytest-emoji/>`_ A pytest plugin that adds emojis to your test result report Feb 19, 2019 4 - Beta pytest (>=4.2.1)
|
||||
`pytest-emoji-output <https://pypi.org/project/pytest-emoji-output/>`_ Pytest plugin to represent test output with emoji support Jun 06, 2021 4 - Beta pytest (==6.0.1)
|
||||
`pytest-enabler <https://pypi.org/project/pytest-enabler/>`_ Enable installed pytest plugins Jan 19, 2021 5 - Production/Stable pytest (!=3.7.3,>=3.5) ; extra == 'testing'
|
||||
@@ -288,6 +290,7 @@ name
|
||||
`pytest-expect <https://pypi.org/project/pytest-expect/>`_ py.test plugin to store test expectations and mark tests based on them Apr 21, 2016 4 - Beta N/A
|
||||
`pytest-expecter <https://pypi.org/project/pytest-expecter/>`_ Better testing with expecter and pytest. Jul 08, 2020 5 - Production/Stable N/A
|
||||
`pytest-expectr <https://pypi.org/project/pytest-expectr/>`_ This plugin is used to expect multiple assert using pytest framework. Oct 05, 2018 N/A pytest (>=2.4.2)
|
||||
`pytest-explicit <https://pypi.org/project/pytest-explicit/>`_ A Pytest plugin to ignore certain marked tests by default Jun 15, 2021 5 - Production/Stable pytest
|
||||
`pytest-exploratory <https://pypi.org/project/pytest-exploratory/>`_ Interactive console for pytest. Jan 20, 2021 N/A pytest (>=5.3)
|
||||
`pytest-external-blockers <https://pypi.org/project/pytest-external-blockers/>`_ a special outcome for tests that are blocked for external reasons Oct 04, 2016 N/A N/A
|
||||
`pytest-extra-durations <https://pypi.org/project/pytest-extra-durations/>`_ A pytest plugin to get durations on a per-function basis and per module basis. Apr 21, 2020 4 - Beta pytest (>=3.5.0)
|
||||
@@ -387,7 +390,7 @@ name
|
||||
`pytest-hue <https://pypi.org/project/pytest-hue/>`_ Visualise PyTest status via your Phillips Hue lights May 09, 2019 N/A N/A
|
||||
`pytest-hylang <https://pypi.org/project/pytest-hylang/>`_ Pytest plugin to allow running tests written in hylang Mar 28, 2021 N/A pytest
|
||||
`pytest-hypo-25 <https://pypi.org/project/pytest-hypo-25/>`_ help hypo module for pytest Jan 12, 2020 3 - Alpha N/A
|
||||
`pytest-ibutsu <https://pypi.org/project/pytest-ibutsu/>`_ A plugin to sent pytest results to an Ibutsu server Mar 09, 2021 4 - Beta pytest
|
||||
`pytest-ibutsu <https://pypi.org/project/pytest-ibutsu/>`_ A plugin to sent pytest results to an Ibutsu server Jun 16, 2021 4 - Beta pytest
|
||||
`pytest-icdiff <https://pypi.org/project/pytest-icdiff/>`_ use icdiff for better error messages in pytest assertions Apr 08, 2020 4 - Beta N/A
|
||||
`pytest-idapro <https://pypi.org/project/pytest-idapro/>`_ A pytest plugin for idapython. Allows a pytest setup to run tests outside and inside IDA in an automated manner by runnig pytest inside IDA and by mocking idapython api Nov 03, 2018 N/A N/A
|
||||
`pytest-ignore-flaky <https://pypi.org/project/pytest-ignore-flaky/>`_ ignore failures from flaky tests (pytest plugin) Apr 23, 2021 5 - Production/Stable N/A
|
||||
@@ -397,7 +400,7 @@ name
|
||||
`pytest-info-collector <https://pypi.org/project/pytest-info-collector/>`_ pytest plugin to collect information from tests May 26, 2019 3 - Alpha N/A
|
||||
`pytest-informative-node <https://pypi.org/project/pytest-informative-node/>`_ display more node ininformation. Apr 25, 2019 4 - Beta N/A
|
||||
`pytest-infrastructure <https://pypi.org/project/pytest-infrastructure/>`_ pytest stack validation prior to testing executing Apr 12, 2020 4 - Beta N/A
|
||||
`pytest-inmanta <https://pypi.org/project/pytest-inmanta/>`_ A py.test plugin providing fixtures to simplify inmanta modules testing. Apr 09, 2021 5 - Production/Stable N/A
|
||||
`pytest-inmanta <https://pypi.org/project/pytest-inmanta/>`_ A py.test plugin providing fixtures to simplify inmanta modules testing. Jun 18, 2021 5 - Production/Stable N/A
|
||||
`pytest-inmanta-extensions <https://pypi.org/project/pytest-inmanta-extensions/>`_ Inmanta tests package May 27, 2021 5 - Production/Stable N/A
|
||||
`pytest-Inomaly <https://pypi.org/project/pytest-Inomaly/>`_ A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A
|
||||
`pytest-insta <https://pypi.org/project/pytest-insta/>`_ A practical snapshot testing plugin for pytest Apr 07, 2021 N/A pytest (>=6.0.2,<7.0.0)
|
||||
@@ -421,7 +424,7 @@ name
|
||||
`pytest-joke <https://pypi.org/project/pytest-joke/>`_ Test failures are better served with humor. Oct 08, 2019 4 - Beta pytest (>=4.2.1)
|
||||
`pytest-json <https://pypi.org/project/pytest-json/>`_ Generate JSON test reports Jan 18, 2016 4 - Beta N/A
|
||||
`pytest-jsonlint <https://pypi.org/project/pytest-jsonlint/>`_ UNKNOWN Aug 04, 2016 N/A N/A
|
||||
`pytest-json-report <https://pypi.org/project/pytest-json-report/>`_ A pytest plugin to report test results as JSON files May 17, 2021 4 - Beta pytest (>=3.8.0)
|
||||
`pytest-json-report <https://pypi.org/project/pytest-json-report/>`_ A pytest plugin to report test results as JSON files Jun 18, 2021 4 - Beta pytest (>=3.8.0)
|
||||
`pytest-kafka <https://pypi.org/project/pytest-kafka/>`_ Zookeeper, Kafka server, and Kafka consumer fixtures for Pytest Nov 01, 2019 N/A pytest
|
||||
`pytest-kind <https://pypi.org/project/pytest-kind/>`_ Kubernetes test support with KIND for pytest Jan 24, 2021 5 - Production/Stable N/A
|
||||
`pytest-kivy <https://pypi.org/project/pytest-kivy/>`_ Kivy GUI tests fixtures using pytest Mar 20, 2021 4 - Beta pytest (>=3.6)
|
||||
@@ -437,7 +440,7 @@ name
|
||||
`pytest-leaks <https://pypi.org/project/pytest-leaks/>`_ A pytest plugin to trace resource leaks. Nov 27, 2019 1 - Planning N/A
|
||||
`pytest-level <https://pypi.org/project/pytest-level/>`_ Select tests of a given level or lower Oct 21, 2019 N/A pytest
|
||||
`pytest-libfaketime <https://pypi.org/project/pytest-libfaketime/>`_ A python-libfaketime plugin for pytest. Dec 22, 2018 4 - Beta pytest (>=3.0.0)
|
||||
`pytest-libiio <https://pypi.org/project/pytest-libiio/>`_ A pytest plugin to manage interfacing with libiio contexts Jan 09, 2021 4 - Beta N/A
|
||||
`pytest-libiio <https://pypi.org/project/pytest-libiio/>`_ A pytest plugin to manage interfacing with libiio contexts Jun 15, 2021 4 - Beta N/A
|
||||
`pytest-libnotify <https://pypi.org/project/pytest-libnotify/>`_ Pytest plugin that shows notifications about the test run Apr 02, 2021 3 - Alpha pytest
|
||||
`pytest-ligo <https://pypi.org/project/pytest-ligo/>`_ Jan 16, 2020 4 - Beta N/A
|
||||
`pytest-lineno <https://pypi.org/project/pytest-lineno/>`_ A pytest plugin to show the line numbers of test functions Dec 04, 2020 N/A pytest
|
||||
@@ -452,6 +455,7 @@ name
|
||||
`pytest-lockable <https://pypi.org/project/pytest-lockable/>`_ lockable resource plugin for pytest Jun 08, 2021 5 - Production/Stable pytest
|
||||
`pytest-locker <https://pypi.org/project/pytest-locker/>`_ Used to lock object during testing. Essentially changing assertions from being hard coded to asserting that nothing changed Feb 25, 2021 N/A pytest (>=5.4)
|
||||
`pytest-logbook <https://pypi.org/project/pytest-logbook/>`_ py.test plugin to capture logbook log messages Nov 23, 2015 5 - Production/Stable pytest (>=2.8)
|
||||
`pytest-logdog <https://pypi.org/project/pytest-logdog/>`_ Pytest plugin to test logging Jun 15, 2021 1 - Planning pytest (>=6.2.0)
|
||||
`pytest-logfest <https://pypi.org/project/pytest-logfest/>`_ Pytest plugin providing three logger fixtures with basic or full writing to log files Jul 21, 2019 4 - Beta pytest (>=3.5.0)
|
||||
`pytest-logger <https://pypi.org/project/pytest-logger/>`_ Plugin configuring handlers for loggers from Python logging module. Jul 25, 2019 4 - Beta pytest (>=3.2)
|
||||
`pytest-logging <https://pypi.org/project/pytest-logging/>`_ Configures logging and allows tweaking the log level with a py.test flag Nov 04, 2015 4 - Beta N/A
|
||||
@@ -510,7 +514,7 @@ name
|
||||
`pytest-mypyd <https://pypi.org/project/pytest-mypyd/>`_ Mypy static type checker plugin for Pytest Aug 20, 2019 4 - Beta pytest (<4.7,>=2.8) ; python_version < "3.5"
|
||||
`pytest-mypy-plugins <https://pypi.org/project/pytest-mypy-plugins/>`_ pytest plugin for writing tests for mypy plugins May 22, 2021 3 - Alpha pytest (>=6.0.0)
|
||||
`pytest-mypy-plugins-shim <https://pypi.org/project/pytest-mypy-plugins-shim/>`_ Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A N/A
|
||||
`pytest-mypy-testing <https://pypi.org/project/pytest-mypy-testing/>`_ Pytest plugin to check mypy output. Apr 24, 2020 N/A pytest
|
||||
`pytest-mypy-testing <https://pypi.org/project/pytest-mypy-testing/>`_ Pytest plugin to check mypy output. Jun 13, 2021 N/A pytest
|
||||
`pytest-mysql <https://pypi.org/project/pytest-mysql/>`_ MySQL process and client fixtures for pytest Jun 01, 2021 5 - Production/Stable pytest
|
||||
`pytest-needle <https://pypi.org/project/pytest-needle/>`_ pytest plugin for visual testing websites using selenium Dec 10, 2018 4 - Beta pytest (<5.0.0,>=3.0.0)
|
||||
`pytest-neo <https://pypi.org/project/pytest-neo/>`_ pytest-neo is a plugin for pytest that shows tests like screen of Matrix. Apr 23, 2019 3 - Alpha pytest (>=3.7.2)
|
||||
@@ -563,7 +567,7 @@ name
|
||||
`pytest-pep257 <https://pypi.org/project/pytest-pep257/>`_ py.test plugin for pep257 Jul 09, 2016 N/A N/A
|
||||
`pytest-pep8 <https://pypi.org/project/pytest-pep8/>`_ pytest plugin to check PEP8 requirements Apr 27, 2014 N/A N/A
|
||||
`pytest-percent <https://pypi.org/project/pytest-percent/>`_ Change the exit code of pytest test sessions when a required percent of tests pass. May 21, 2020 N/A pytest (>=5.2.0)
|
||||
`pytest-perf <https://pypi.org/project/pytest-perf/>`_ pytest-perf May 29, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing'
|
||||
`pytest-perf <https://pypi.org/project/pytest-perf/>`_ pytest-perf Jun 26, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing'
|
||||
`pytest-performance <https://pypi.org/project/pytest-performance/>`_ A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0)
|
||||
`pytest-persistence <https://pypi.org/project/pytest-persistence/>`_ Pytest tool for persistent objects Mar 28, 2021 N/A N/A
|
||||
`pytest-pgsql <https://pypi.org/project/pytest-pgsql/>`_ Pytest plugins and helpers for tests using a Postgres database. May 13, 2020 5 - Production/Stable pytest (>=3.0.0)
|
||||
@@ -596,7 +600,7 @@ name
|
||||
`pytest-postgresql <https://pypi.org/project/pytest-postgresql/>`_ Postgresql fixtures and fixture factories for Pytest. Jun 01, 2021 5 - Production/Stable pytest (>=3.0.0)
|
||||
`pytest-power <https://pypi.org/project/pytest-power/>`_ pytest plugin with powerful fixtures Dec 31, 2020 N/A pytest (>=5.4)
|
||||
`pytest-pride <https://pypi.org/project/pytest-pride/>`_ Minitest-style test colors Apr 02, 2016 3 - Alpha N/A
|
||||
`pytest-print <https://pypi.org/project/pytest-print/>`_ pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout) Oct 23, 2020 5 - Production/Stable pytest (>=3.0.0)
|
||||
`pytest-print <https://pypi.org/project/pytest-print/>`_ pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout) Jun 17, 2021 5 - Production/Stable pytest (>=6)
|
||||
`pytest-profiling <https://pypi.org/project/pytest-profiling/>`_ Profiling plugin for py.test May 28, 2019 5 - Production/Stable pytest
|
||||
`pytest-progress <https://pypi.org/project/pytest-progress/>`_ pytest plugin for instant test progress status Oct 06, 2020 5 - Production/Stable N/A
|
||||
`pytest-prometheus <https://pypi.org/project/pytest-prometheus/>`_ Report test pass / failures to a Prometheus PushGateway Oct 03, 2017 N/A N/A
|
||||
@@ -618,9 +622,9 @@ name
|
||||
`pytest-pytestrail <https://pypi.org/project/pytest-pytestrail/>`_ Pytest plugin for interaction with TestRail Aug 27, 2020 4 - Beta pytest (>=3.8.0)
|
||||
`pytest-pythonpath <https://pypi.org/project/pytest-pythonpath/>`_ pytest plugin for adding to the PYTHONPATH from command line or configs. Aug 22, 2018 5 - Production/Stable N/A
|
||||
`pytest-pytorch <https://pypi.org/project/pytest-pytorch/>`_ pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest
|
||||
`pytest-qatouch <https://pypi.org/project/pytest-qatouch/>`_ Pytest plugin for uploading test results to your QA Touch Testrun. Jun 10, 2021 4 - Beta pytest (>=6.2.0)
|
||||
`pytest-qatouch <https://pypi.org/project/pytest-qatouch/>`_ Pytest plugin for uploading test results to your QA Touch Testrun. Jun 26, 2021 4 - Beta pytest (>=6.2.0)
|
||||
`pytest-qml <https://pypi.org/project/pytest-qml/>`_ Run QML Tests with pytest Dec 02, 2020 4 - Beta pytest (>=6.0.0)
|
||||
`pytest-qt <https://pypi.org/project/pytest-qt/>`_ pytest support for PyQt and PySide applications Jun 07, 2021 5 - Production/Stable pytest (>=3.0.0)
|
||||
`pytest-qt <https://pypi.org/project/pytest-qt/>`_ pytest support for PyQt and PySide applications Jun 13, 2021 5 - Production/Stable pytest (>=3.0.0)
|
||||
`pytest-qt-app <https://pypi.org/project/pytest-qt-app/>`_ QT app fixture for py.test Dec 23, 2015 5 - Production/Stable N/A
|
||||
`pytest-quarantine <https://pypi.org/project/pytest-quarantine/>`_ A plugin for pytest to manage expected test failures Nov 24, 2019 5 - Production/Stable pytest (>=4.6)
|
||||
`pytest-quickcheck <https://pypi.org/project/pytest-quickcheck/>`_ pytest plugin to generate random data inspired by QuickCheck Nov 15, 2020 4 - Beta pytest (<6.0.0,>=4.0)
|
||||
@@ -649,6 +653,7 @@ name
|
||||
`pytest-relaxed <https://pypi.org/project/pytest-relaxed/>`_ Relaxed test discovery/organization for pytest Jun 14, 2019 5 - Production/Stable pytest (<5,>=3)
|
||||
`pytest-remfiles <https://pypi.org/project/pytest-remfiles/>`_ Pytest plugin to create a temporary directory with remote files Jul 01, 2019 5 - Production/Stable N/A
|
||||
`pytest-remotedata <https://pypi.org/project/pytest-remotedata/>`_ Pytest plugin for controlling remote data access. Jul 20, 2019 3 - Alpha pytest (>=3.1)
|
||||
`pytest-remote-response <https://pypi.org/project/pytest-remote-response/>`_ Pytest plugin for capturing and mocking connection requests. Jun 23, 2021 3 - Alpha pytest (>=4.6)
|
||||
`pytest-remove-stale-bytecode <https://pypi.org/project/pytest-remove-stale-bytecode/>`_ py.test plugin to remove stale byte code files. Mar 04, 2020 4 - Beta pytest
|
||||
`pytest-reorder <https://pypi.org/project/pytest-reorder/>`_ Reorder tests depending on their paths and names. May 31, 2018 4 - Beta pytest
|
||||
`pytest-repeat <https://pypi.org/project/pytest-repeat/>`_ pytest plugin for repeating tests Oct 31, 2020 5 - Production/Stable pytest (>=3.6)
|
||||
@@ -662,10 +667,10 @@ name
|
||||
`pytest-reportlog <https://pypi.org/project/pytest-reportlog/>`_ Replacement for the --resultlog option, focused in simplicity and extensibility Dec 11, 2020 3 - Alpha pytest (>=5.2)
|
||||
`pytest-report-me <https://pypi.org/project/pytest-report-me/>`_ A pytest plugin to generate report. Dec 31, 2020 N/A pytest
|
||||
`pytest-report-parameters <https://pypi.org/project/pytest-report-parameters/>`_ pytest plugin for adding tests' parameters to junit report Jun 18, 2020 3 - Alpha pytest (>=2.4.2)
|
||||
`pytest-reportportal <https://pypi.org/project/pytest-reportportal/>`_ Agent for Reporting results of tests to the Report Portal Jun 09, 2021 N/A pytest (>=3.8.0)
|
||||
`pytest-reportportal <https://pypi.org/project/pytest-reportportal/>`_ Agent for Reporting results of tests to the Report Portal Jun 18, 2021 N/A pytest (>=3.8.0)
|
||||
`pytest-reqs <https://pypi.org/project/pytest-reqs/>`_ pytest plugin to check pinned requirements May 12, 2019 N/A pytest (>=2.4.2)
|
||||
`pytest-requests <https://pypi.org/project/pytest-requests/>`_ A simple plugin to use with pytest Jun 24, 2019 4 - Beta pytest (>=3.5.0)
|
||||
`pytest-reraise <https://pypi.org/project/pytest-reraise/>`_ Make multi-threaded pytest test cases fail when they should Jun 09, 2021 5 - Production/Stable pytest (>=4.6)
|
||||
`pytest-reraise <https://pypi.org/project/pytest-reraise/>`_ Make multi-threaded pytest test cases fail when they should Jun 17, 2021 5 - Production/Stable pytest (>=4.6)
|
||||
`pytest-rerun <https://pypi.org/project/pytest-rerun/>`_ Re-run only changed files in specified branch Jul 08, 2019 N/A pytest (>=3.6)
|
||||
`pytest-rerunfailures <https://pypi.org/project/pytest-rerunfailures/>`_ pytest plugin to re-run tests to eliminate flaky failures May 26, 2021 5 - Production/Stable pytest (>=5.3)
|
||||
`pytest-resilient-circuits <https://pypi.org/project/pytest-resilient-circuits/>`_ Resilient Circuits fixtures for PyTest. May 14, 2021 N/A N/A
|
||||
@@ -689,19 +694,19 @@ name
|
||||
`pytest-runner <https://pypi.org/project/pytest-runner/>`_ Invoke py.test as distutils command with dependency resolution May 19, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing'
|
||||
`pytest-salt <https://pypi.org/project/pytest-salt/>`_ Pytest Salt Plugin Jan 27, 2020 4 - Beta N/A
|
||||
`pytest-salt-containers <https://pypi.org/project/pytest-salt-containers/>`_ A Pytest plugin that builds and creates docker containers Nov 09, 2016 4 - Beta N/A
|
||||
`pytest-salt-factories <https://pypi.org/project/pytest-salt-factories/>`_ Pytest Salt Plugin Jun 11, 2021 4 - Beta pytest (>=6.0.0)
|
||||
`pytest-salt-factories <https://pypi.org/project/pytest-salt-factories/>`_ Pytest Salt Plugin Jun 20, 2021 4 - Beta pytest (>=6.0.0)
|
||||
`pytest-salt-from-filenames <https://pypi.org/project/pytest-salt-from-filenames/>`_ Simple PyTest Plugin For Salt's Test Suite Specifically Jan 29, 2019 4 - Beta pytest (>=4.1)
|
||||
`pytest-salt-runtests-bridge <https://pypi.org/project/pytest-salt-runtests-bridge/>`_ Simple PyTest Plugin For Salt's Test Suite Specifically Dec 05, 2019 4 - Beta pytest (>=4.1)
|
||||
`pytest-sanic <https://pypi.org/project/pytest-sanic/>`_ a pytest plugin for Sanic May 20, 2021 N/A pytest (>=5.2)
|
||||
`pytest-sanity <https://pypi.org/project/pytest-sanity/>`_ Dec 07, 2020 N/A N/A
|
||||
`pytest-sa-pg <https://pypi.org/project/pytest-sa-pg/>`_ May 14, 2019 N/A N/A
|
||||
`pytest-sbase <https://pypi.org/project/pytest-sbase/>`_ A complete web automation framework for end-to-end testing. Jun 05, 2021 5 - Production/Stable N/A
|
||||
`pytest-sbase <https://pypi.org/project/pytest-sbase/>`_ A complete web automation framework for end-to-end testing. Jun 21, 2021 5 - Production/Stable N/A
|
||||
`pytest-scenario <https://pypi.org/project/pytest-scenario/>`_ pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A
|
||||
`pytest-schema <https://pypi.org/project/pytest-schema/>`_ 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0)
|
||||
`pytest-securestore <https://pypi.org/project/pytest-securestore/>`_ An encrypted password store for use within pytest cases Jun 19, 2019 4 - Beta N/A
|
||||
`pytest-select <https://pypi.org/project/pytest-select/>`_ A pytest plugin which allows to (de-)select tests from a file. Jan 18, 2019 3 - Alpha pytest (>=3.0)
|
||||
`pytest-selenium <https://pypi.org/project/pytest-selenium/>`_ pytest plugin for Selenium Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0)
|
||||
`pytest-seleniumbase <https://pypi.org/project/pytest-seleniumbase/>`_ A complete web automation framework for end-to-end testing. Jun 05, 2021 5 - Production/Stable N/A
|
||||
`pytest-seleniumbase <https://pypi.org/project/pytest-seleniumbase/>`_ A complete web automation framework for end-to-end testing. Jun 21, 2021 5 - Production/Stable N/A
|
||||
`pytest-selenium-enhancer <https://pypi.org/project/pytest-selenium-enhancer/>`_ pytest plugin for Selenium Nov 26, 2020 5 - Production/Stable N/A
|
||||
`pytest-selenium-pdiff <https://pypi.org/project/pytest-selenium-pdiff/>`_ A pytest package implementing perceptualdiff for Selenium tests. Apr 06, 2017 2 - Pre-Alpha N/A
|
||||
`pytest-send-email <https://pypi.org/project/pytest-send-email/>`_ Send pytest execution result email Dec 04, 2019 N/A N/A
|
||||
@@ -719,7 +724,7 @@ name
|
||||
`pytest-sherlock <https://pypi.org/project/pytest-sherlock/>`_ pytest plugin help to find coupled tests Jul 13, 2020 5 - Production/Stable pytest (>=3.5.1)
|
||||
`pytest-shortcuts <https://pypi.org/project/pytest-shortcuts/>`_ Expand command-line shortcuts listed in pytest configuration Oct 29, 2020 4 - Beta pytest (>=3.5.0)
|
||||
`pytest-shutil <https://pypi.org/project/pytest-shutil/>`_ A goodie-bag of unix shell and environment tools for py.test May 28, 2019 5 - Production/Stable pytest
|
||||
`pytest-simplehttpserver <https://pypi.org/project/pytest-simplehttpserver/>`_ Simple pytest fixture to spin up an HTTP server Jun 12, 2021 4 - Beta N/A
|
||||
`pytest-simplehttpserver <https://pypi.org/project/pytest-simplehttpserver/>`_ Simple pytest fixture to spin up an HTTP server Jun 24, 2021 4 - Beta N/A
|
||||
`pytest-simple-plugin <https://pypi.org/project/pytest-simple-plugin/>`_ Simple pytest plugin Nov 27, 2019 N/A N/A
|
||||
`pytest-simple-settings <https://pypi.org/project/pytest-simple-settings/>`_ simple-settings plugin for pytest Nov 17, 2020 4 - Beta pytest
|
||||
`pytest-single-file-logging <https://pypi.org/project/pytest-single-file-logging/>`_ Allow for multiple processes to log to a single file May 05, 2016 4 - Beta pytest (>=2.8.1)
|
||||
@@ -744,12 +749,12 @@ name
|
||||
`pytest-sphinx <https://pypi.org/project/pytest-sphinx/>`_ Doctest plugin for pytest with support for Sphinx-specific doctest-directives Aug 05, 2020 4 - Beta N/A
|
||||
`pytest-spiratest <https://pypi.org/project/pytest-spiratest/>`_ Exports unit tests as test runs in SpiraTest/Team/Plan Apr 28, 2021 N/A N/A
|
||||
`pytest-splinter <https://pypi.org/project/pytest-splinter/>`_ Splinter plugin for pytest testing framework Dec 25, 2020 6 - Mature N/A
|
||||
`pytest-split <https://pypi.org/project/pytest-split/>`_ Pytest plugin for splitting test suite based on test execution time Jun 08, 2021 4 - Beta N/A
|
||||
`pytest-split <https://pypi.org/project/pytest-split/>`_ Pytest plugin for splitting test suite based on test execution time Jun 17, 2021 4 - Beta pytest (>=5,<7)
|
||||
`pytest-splitio <https://pypi.org/project/pytest-splitio/>`_ Split.io SDK integration for e2e tests Sep 22, 2020 N/A pytest (<7,>=5.0)
|
||||
`pytest-split-tests <https://pypi.org/project/pytest-split-tests/>`_ A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. May 28, 2019 N/A pytest (>=2.5)
|
||||
`pytest-split-tests-tresorit <https://pypi.org/project/pytest-split-tests-tresorit/>`_ Feb 22, 2021 1 - Planning N/A
|
||||
`pytest-splunk-addon <https://pypi.org/project/pytest-splunk-addon/>`_ A Dynamic test tool for Splunk Apps and Add-ons Apr 28, 2021 N/A pytest (>5.4.0,<6.3)
|
||||
`pytest-splunk-addon-ui-smartx <https://pypi.org/project/pytest-splunk-addon-ui-smartx/>`_ Library to support testing Splunk Add-on UX Jun 10, 2021 N/A N/A
|
||||
`pytest-splunk-addon <https://pypi.org/project/pytest-splunk-addon/>`_ A Dynamic test tool for Splunk Apps and Add-ons Jun 21, 2021 N/A pytest (>5.4.0,<6.3)
|
||||
`pytest-splunk-addon-ui-smartx <https://pypi.org/project/pytest-splunk-addon-ui-smartx/>`_ Library to support testing Splunk Add-on UX Jun 17, 2021 N/A N/A
|
||||
`pytest-splunk-env <https://pypi.org/project/pytest-splunk-env/>`_ pytest fixtures for interaction with Splunk Enterprise and Splunk Cloud Oct 22, 2020 N/A pytest (>=6.1.1,<7.0.0)
|
||||
`pytest-sqitch <https://pypi.org/project/pytest-sqitch/>`_ sqitch for pytest Apr 06, 2020 4 - Beta N/A
|
||||
`pytest-sqlalchemy <https://pypi.org/project/pytest-sqlalchemy/>`_ pytest plugin with sqlalchemy related fixtures Mar 13, 2018 3 - Alpha N/A
|
||||
@@ -768,7 +773,7 @@ name
|
||||
`pytest-stub <https://pypi.org/project/pytest-stub/>`_ Stub packages, modules and attributes. Apr 28, 2020 5 - Production/Stable N/A
|
||||
`pytest-stubprocess <https://pypi.org/project/pytest-stubprocess/>`_ Provide stub implementations for subprocesses in Python tests Sep 17, 2018 3 - Alpha pytest (>=3.5.0)
|
||||
`pytest-study <https://pypi.org/project/pytest-study/>`_ A pytest plugin to organize long run tests (named studies) without interfering the regular tests Sep 26, 2017 3 - Alpha pytest (>=2.0)
|
||||
`pytest-subprocess <https://pypi.org/project/pytest-subprocess/>`_ A plugin to fake subprocess for pytest Apr 18, 2021 5 - Production/Stable pytest (>=4.0.0)
|
||||
`pytest-subprocess <https://pypi.org/project/pytest-subprocess/>`_ A plugin to fake subprocess for pytest Jun 18, 2021 5 - Production/Stable pytest (>=4.0.0)
|
||||
`pytest-subtesthack <https://pypi.org/project/pytest-subtesthack/>`_ A hack to explicitly set up and tear down fixtures. Mar 02, 2021 N/A N/A
|
||||
`pytest-subtests <https://pypi.org/project/pytest-subtests/>`_ unittest subTest() support and subtests fixture May 29, 2021 4 - Beta pytest (>=5.3.0)
|
||||
`pytest-subunit <https://pypi.org/project/pytest-subunit/>`_ pytest-subunit is a plugin for py.test which outputs testsresult in subunit format. Aug 29, 2017 N/A N/A
|
||||
@@ -791,13 +796,13 @@ name
|
||||
`pytest-testdirectory <https://pypi.org/project/pytest-testdirectory/>`_ A py.test plugin providing temporary directories in unit tests. Nov 06, 2018 5 - Production/Stable pytest
|
||||
`pytest-testdox <https://pypi.org/project/pytest-testdox/>`_ A testdox format reporter for pytest Oct 13, 2020 5 - Production/Stable pytest (>=3.7.0)
|
||||
`pytest-test-groups <https://pypi.org/project/pytest-test-groups/>`_ A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Oct 25, 2016 5 - Production/Stable N/A
|
||||
`pytest-testinfra <https://pypi.org/project/pytest-testinfra/>`_ Test infrastructures Apr 18, 2021 5 - Production/Stable pytest (!=3.0.2)
|
||||
`pytest-testinfra <https://pypi.org/project/pytest-testinfra/>`_ Test infrastructures Jun 20, 2021 5 - Production/Stable pytest (!=3.0.2)
|
||||
`pytest-testlink-adaptor <https://pypi.org/project/pytest-testlink-adaptor/>`_ pytest reporting plugin for testlink Dec 20, 2018 4 - Beta pytest (>=2.6)
|
||||
`pytest-testmon <https://pypi.org/project/pytest-testmon/>`_ selects tests affected by changed files and methods Apr 28, 2021 4 - Beta N/A
|
||||
`pytest-testobject <https://pypi.org/project/pytest-testobject/>`_ Plugin to use TestObject Suites with Pytest Sep 24, 2019 4 - Beta pytest (>=3.1.1)
|
||||
`pytest-testrail <https://pypi.org/project/pytest-testrail/>`_ pytest plugin for creating TestRail runs and adding results Aug 27, 2020 N/A pytest (>=3.6)
|
||||
`pytest-testrail2 <https://pypi.org/project/pytest-testrail2/>`_ A small example package Nov 17, 2020 N/A pytest (>=5)
|
||||
`pytest-testrail-api <https://pypi.org/project/pytest-testrail-api/>`_ Плагин Pytest, для интеграции с TestRail Apr 23, 2021 N/A pytest (>=5.5)
|
||||
`pytest-testrail-api <https://pypi.org/project/pytest-testrail-api/>`_ Плагин Pytest, для интеграции с TestRail Jun 23, 2021 N/A pytest (>=5.5)
|
||||
`pytest-testrail-client <https://pypi.org/project/pytest-testrail-client/>`_ pytest plugin for Testrail Sep 29, 2020 5 - Production/Stable N/A
|
||||
`pytest-testrail-e2e <https://pypi.org/project/pytest-testrail-e2e/>`_ pytest plugin for creating TestRail runs and adding results Jun 11, 2020 N/A pytest (>=3.6)
|
||||
`pytest-testrail-plugin <https://pypi.org/project/pytest-testrail-plugin/>`_ PyTest plugin for TestRail Apr 21, 2020 3 - Alpha pytest
|
||||
@@ -844,9 +849,11 @@ name
|
||||
`pytest-unittest-filter <https://pypi.org/project/pytest-unittest-filter/>`_ A pytest plugin for filtering unittest-based test classes Jan 12, 2019 4 - Beta pytest (>=3.1.0)
|
||||
`pytest-unmarked <https://pypi.org/project/pytest-unmarked/>`_ Run only unmarked tests Aug 27, 2019 5 - Production/Stable N/A
|
||||
`pytest-unordered <https://pypi.org/project/pytest-unordered/>`_ Test equality of unordered collections in pytest Mar 28, 2021 4 - Beta N/A
|
||||
`pytest-upload-report <https://pypi.org/project/pytest-upload-report/>`_ pytest-upload-report is a plugin for pytest that upload your test report for test results. Jun 18, 2021 5 - Production/Stable N/A
|
||||
`pytest-vagrant <https://pypi.org/project/pytest-vagrant/>`_ A py.test plugin providing access to vagrant. Mar 23, 2020 5 - Production/Stable pytest
|
||||
`pytest-valgrind <https://pypi.org/project/pytest-valgrind/>`_ May 19, 2021 N/A N/A
|
||||
`pytest-variables <https://pypi.org/project/pytest-variables/>`_ pytest plugin for providing variables to tests/fixtures Oct 23, 2019 5 - Production/Stable pytest (>=2.4.2)
|
||||
`pytest-variant <https://pypi.org/project/pytest-variant/>`_ Variant support for Pytest Jun 20, 2021 N/A N/A
|
||||
`pytest-vcr <https://pypi.org/project/pytest-vcr/>`_ Plugin for managing VCR.py cassettes Apr 26, 2019 5 - Production/Stable pytest (>=3.6.0)
|
||||
`pytest-vcrpandas <https://pypi.org/project/pytest-vcrpandas/>`_ Test from HTTP interactions to dataframe processed. Jan 12, 2019 4 - Beta pytest
|
||||
`pytest-venv <https://pypi.org/project/pytest-venv/>`_ py.test fixture for creating a virtual environment Aug 04, 2020 4 - Beta pytest
|
||||
@@ -867,7 +874,7 @@ name
|
||||
`pytest-wholenodeid <https://pypi.org/project/pytest-wholenodeid/>`_ pytest addon for displaying the whole node id for failures Aug 26, 2015 4 - Beta pytest (>=2.0)
|
||||
`pytest-winnotify <https://pypi.org/project/pytest-winnotify/>`_ Windows tray notifications for py.test results. Apr 22, 2016 N/A N/A
|
||||
`pytest-workflow <https://pypi.org/project/pytest-workflow/>`_ A pytest plugin for configuring workflow/pipeline tests using YAML files Dec 14, 2020 5 - Production/Stable pytest (>=5.4.0)
|
||||
`pytest-xdist <https://pypi.org/project/pytest-xdist/>`_ pytest xdist plugin for distributed testing and loop-on-failing modes Feb 09, 2021 5 - Production/Stable pytest (>=6.0.0)
|
||||
`pytest-xdist <https://pypi.org/project/pytest-xdist/>`_ pytest xdist plugin for distributed testing and loop-on-failing modes Jun 16, 2021 5 - Production/Stable pytest (>=6.0.0)
|
||||
`pytest-xdist-debug-for-graingert <https://pypi.org/project/pytest-xdist-debug-for-graingert/>`_ pytest xdist plugin for distributed testing and loop-on-failing modes Jul 24, 2019 5 - Production/Stable pytest (>=4.4.0)
|
||||
`pytest-xdist-forked <https://pypi.org/project/pytest-xdist-forked/>`_ forked from pytest-xdist Feb 10, 2020 5 - Production/Stable pytest (>=4.4.0)
|
||||
`pytest-xdist-tracker <https://pypi.org/project/pytest-xdist-tracker/>`_ pytest plugin helps to reproduce failures for particular xdist node May 05, 2021 3 - Alpha pytest (>=3.5.1)
|
||||
|
||||
@@ -46,14 +46,16 @@ def login(token: str) -> Repository:
|
||||
return github.repository(owner, repo)
|
||||
|
||||
|
||||
def prepare_release_pr(base_branch: str, is_major: bool, token: str) -> None:
|
||||
def prepare_release_pr(
|
||||
base_branch: str, is_major: bool, token: str, prerelease: str
|
||||
) -> None:
|
||||
print()
|
||||
print(f"Processing release for branch {Fore.CYAN}{base_branch}")
|
||||
|
||||
check_call(["git", "checkout", f"origin/{base_branch}"])
|
||||
|
||||
try:
|
||||
version = find_next_version(base_branch, is_major)
|
||||
version = find_next_version(base_branch, is_major, prerelease)
|
||||
except InvalidFeatureRelease as e:
|
||||
print(f"{Fore.RED}{e}")
|
||||
raise SystemExit(1)
|
||||
@@ -64,22 +66,16 @@ def prepare_release_pr(base_branch: str, is_major: bool, token: str) -> None:
|
||||
|
||||
run(
|
||||
["git", "config", "user.name", "pytest bot"],
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
run(
|
||||
["git", "config", "user.email", "pytestbot@gmail.com"],
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
run(
|
||||
["git", "checkout", "-b", release_branch, f"origin/{base_branch}"],
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
print(f"Branch {Fore.CYAN}{release_branch}{Fore.RESET} created.")
|
||||
@@ -90,17 +86,13 @@ def prepare_release_pr(base_branch: str, is_major: bool, token: str) -> None:
|
||||
print("Running", " ".join(cmdline))
|
||||
run(
|
||||
cmdline,
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
oauth_url = f"https://{token}:x-oauth-basic@github.com/{SLUG}.git"
|
||||
run(
|
||||
["git", "push", oauth_url, f"HEAD:{release_branch}", "--force"],
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
print(f"Branch {Fore.CYAN}{release_branch}{Fore.RESET} pushed.")
|
||||
|
||||
@@ -115,7 +107,7 @@ def prepare_release_pr(base_branch: str, is_major: bool, token: str) -> None:
|
||||
print(f"Pull request {Fore.CYAN}{pr.url}{Fore.RESET} created.")
|
||||
|
||||
|
||||
def find_next_version(base_branch: str, is_major: bool) -> str:
|
||||
def find_next_version(base_branch: str, is_major: bool, prerelease: str) -> str:
|
||||
output = check_output(["git", "tag"], encoding="UTF-8")
|
||||
valid_versions = []
|
||||
for v in output.splitlines():
|
||||
@@ -133,11 +125,11 @@ def find_next_version(base_branch: str, is_major: bool) -> str:
|
||||
is_feature_release = features or breaking
|
||||
|
||||
if is_major:
|
||||
return f"{last_version[0]+1}.0.0"
|
||||
return f"{last_version[0]+1}.0.0{prerelease}"
|
||||
elif is_feature_release:
|
||||
return f"{last_version[0]}.{last_version[1] + 1}.0"
|
||||
return f"{last_version[0]}.{last_version[1] + 1}.0{prerelease}"
|
||||
else:
|
||||
return f"{last_version[0]}.{last_version[1]}.{last_version[2] + 1}"
|
||||
return f"{last_version[0]}.{last_version[1]}.{last_version[2] + 1}{prerelease}"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
@@ -146,9 +138,13 @@ def main() -> None:
|
||||
parser.add_argument("base_branch")
|
||||
parser.add_argument("token")
|
||||
parser.add_argument("--major", action="store_true", default=False)
|
||||
parser.add_argument("--prerelease", default="")
|
||||
options = parser.parse_args()
|
||||
prepare_release_pr(
|
||||
base_branch=options.base_branch, is_major=options.major, token=options.token
|
||||
base_branch=options.base_branch,
|
||||
is_major=options.major,
|
||||
token=options.token,
|
||||
prerelease=options.prerelease,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,261 +0,0 @@
|
||||
"""
|
||||
This script is part of the pytest release process which is triggered by comments
|
||||
in issues.
|
||||
|
||||
This script is started by the `release-on-comment.yml` workflow, which always executes on
|
||||
`main` and is triggered by two comment related events:
|
||||
|
||||
* https://help.github.com/en/actions/reference/events-that-trigger-workflows#issue-comment-event-issue_comment
|
||||
* https://help.github.com/en/actions/reference/events-that-trigger-workflows#issues-event-issues
|
||||
|
||||
This script receives the payload and a secrets on the command line.
|
||||
|
||||
The payload must contain a comment with a phrase matching this pseudo-regular expression:
|
||||
|
||||
@pytestbot please prepare (major )? release from <branch name>
|
||||
|
||||
Then the appropriate version will be obtained based on the given branch name:
|
||||
|
||||
* a major release from main if "major" appears in the phrase in that position
|
||||
* a feature or bug fix release from main (based if there are features in the current changelog
|
||||
folder)
|
||||
* a bug fix from a maintenance branch
|
||||
|
||||
After that, it will create a release using the `release` tox environment, and push a new PR.
|
||||
|
||||
**Token**: currently the token from the GitHub Actions is used, pushed with
|
||||
`pytest bot <pytestbot@gmail.com>` commit author.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from subprocess import CalledProcessError
|
||||
from subprocess import check_call
|
||||
from subprocess import check_output
|
||||
from subprocess import run
|
||||
from textwrap import dedent
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
from typing import Tuple
|
||||
|
||||
from colorama import Fore
|
||||
from colorama import init
|
||||
from github3.repos import Repository
|
||||
|
||||
|
||||
class InvalidFeatureRelease(Exception):
|
||||
pass
|
||||
|
||||
|
||||
SLUG = "pytest-dev/pytest"
|
||||
|
||||
PR_BODY = """\
|
||||
Created automatically from {comment_url}.
|
||||
|
||||
Once all builds pass and it has been **approved** by one or more maintainers, the build
|
||||
can be released by pushing a tag `{version}` to this repository.
|
||||
|
||||
Closes #{issue_number}.
|
||||
"""
|
||||
|
||||
|
||||
def login(token: str) -> Repository:
|
||||
import github3
|
||||
|
||||
github = github3.login(token=token)
|
||||
owner, repo = SLUG.split("/")
|
||||
return github.repository(owner, repo)
|
||||
|
||||
|
||||
def get_comment_data(payload: Dict) -> str:
|
||||
if "comment" in payload:
|
||||
return payload["comment"]
|
||||
else:
|
||||
return payload["issue"]
|
||||
|
||||
|
||||
def validate_and_get_issue_comment_payload(
|
||||
issue_payload_path: Optional[Path],
|
||||
) -> Tuple[str, str, bool]:
|
||||
payload = json.loads(issue_payload_path.read_text(encoding="UTF-8"))
|
||||
body = get_comment_data(payload)["body"]
|
||||
m = re.match(r"@pytestbot please prepare (major )?release from ([-_.\w]+)", body)
|
||||
if m:
|
||||
is_major, base_branch = m.group(1) is not None, m.group(2)
|
||||
else:
|
||||
is_major, base_branch = False, None
|
||||
return payload, base_branch, is_major
|
||||
|
||||
|
||||
def print_and_exit(msg) -> None:
|
||||
print(msg)
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
def trigger_release(payload_path: Path, token: str) -> None:
|
||||
payload, base_branch, is_major = validate_and_get_issue_comment_payload(
|
||||
payload_path
|
||||
)
|
||||
if base_branch is None:
|
||||
url = get_comment_data(payload)["html_url"]
|
||||
print_and_exit(
|
||||
f"Comment {Fore.CYAN}{url}{Fore.RESET} did not match the trigger command."
|
||||
)
|
||||
print()
|
||||
print(f"Precessing release for branch {Fore.CYAN}{base_branch}")
|
||||
|
||||
repo = login(token)
|
||||
|
||||
issue_number = payload["issue"]["number"]
|
||||
issue = repo.issue(issue_number)
|
||||
|
||||
check_call(["git", "checkout", f"origin/{base_branch}"])
|
||||
|
||||
try:
|
||||
version = find_next_version(base_branch, is_major)
|
||||
except InvalidFeatureRelease as e:
|
||||
issue.create_comment(str(e))
|
||||
print_and_exit(f"{Fore.RED}{e}")
|
||||
|
||||
error_contents = ""
|
||||
try:
|
||||
print(f"Version: {Fore.CYAN}{version}")
|
||||
|
||||
release_branch = f"release-{version}"
|
||||
|
||||
run(
|
||||
["git", "config", "user.name", "pytest bot"],
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
run(
|
||||
["git", "config", "user.email", "pytestbot@gmail.com"],
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
run(
|
||||
["git", "checkout", "-b", release_branch, f"origin/{base_branch}"],
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
print(f"Branch {Fore.CYAN}{release_branch}{Fore.RESET} created.")
|
||||
|
||||
# important to use tox here because we have changed branches, so dependencies
|
||||
# might have changed as well
|
||||
cmdline = ["tox", "-e", "release", "--", version, "--skip-check-links"]
|
||||
print("Running", " ".join(cmdline))
|
||||
run(
|
||||
cmdline,
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
oauth_url = f"https://{token}:x-oauth-basic@github.com/{SLUG}.git"
|
||||
run(
|
||||
["git", "push", oauth_url, f"HEAD:{release_branch}", "--force"],
|
||||
text=True,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
print(f"Branch {Fore.CYAN}{release_branch}{Fore.RESET} pushed.")
|
||||
|
||||
body = PR_BODY.format(
|
||||
comment_url=get_comment_data(payload)["html_url"],
|
||||
version=version,
|
||||
issue_number=issue_number,
|
||||
)
|
||||
pr = repo.create_pull(
|
||||
f"Prepare release {version}",
|
||||
base=base_branch,
|
||||
head=release_branch,
|
||||
body=body,
|
||||
)
|
||||
print(f"Pull request {Fore.CYAN}{pr.url}{Fore.RESET} created.")
|
||||
|
||||
comment = issue.create_comment(
|
||||
f"As requested, opened a PR for release `{version}`: #{pr.number}."
|
||||
)
|
||||
print(f"Notified in original comment {Fore.CYAN}{comment.url}{Fore.RESET}.")
|
||||
|
||||
except CalledProcessError as e:
|
||||
error_contents = f"CalledProcessError\noutput:\n{e.output}\nstderr:\n{e.stderr}"
|
||||
except Exception:
|
||||
error_contents = f"Exception:\n{traceback.format_exc()}"
|
||||
|
||||
if error_contents:
|
||||
link = f"https://github.com/{SLUG}/actions/runs/{os.environ['GITHUB_RUN_ID']}"
|
||||
msg = ERROR_COMMENT.format(
|
||||
version=version, base_branch=base_branch, contents=error_contents, link=link
|
||||
)
|
||||
issue.create_comment(msg)
|
||||
print_and_exit(f"{Fore.RED}{error_contents}")
|
||||
else:
|
||||
print(f"{Fore.GREEN}Success.")
|
||||
|
||||
|
||||
ERROR_COMMENT = """\
|
||||
The request to prepare release `{version}` from {base_branch} failed with:
|
||||
|
||||
```
|
||||
{contents}
|
||||
```
|
||||
|
||||
See: {link}.
|
||||
"""
|
||||
|
||||
|
||||
def find_next_version(base_branch: str, is_major: bool) -> str:
|
||||
output = check_output(["git", "tag"], encoding="UTF-8")
|
||||
valid_versions = []
|
||||
for v in output.splitlines():
|
||||
m = re.match(r"\d.\d.\d+$", v.strip())
|
||||
if m:
|
||||
valid_versions.append(tuple(int(x) for x in v.split(".")))
|
||||
|
||||
valid_versions.sort()
|
||||
last_version = valid_versions[-1]
|
||||
|
||||
changelog = Path("changelog")
|
||||
|
||||
features = list(changelog.glob("*.feature.rst"))
|
||||
breaking = list(changelog.glob("*.breaking.rst"))
|
||||
is_feature_release = features or breaking
|
||||
|
||||
if is_feature_release and base_branch != "main":
|
||||
msg = dedent(
|
||||
f"""
|
||||
Found features or breaking changes in `{base_branch}`, and feature releases can only be
|
||||
created from `main`:
|
||||
"""
|
||||
)
|
||||
msg += "\n".join(f"* `{x.name}`" for x in sorted(features + breaking))
|
||||
raise InvalidFeatureRelease(msg)
|
||||
|
||||
if is_major:
|
||||
return f"{last_version[0]+1}.0.0"
|
||||
elif is_feature_release:
|
||||
return f"{last_version[0]}.{last_version[1] + 1}.0"
|
||||
else:
|
||||
return f"{last_version[0]}.{last_version[1]}.{last_version[2] + 1}"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
init(autoreset=True)
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("payload")
|
||||
parser.add_argument("token")
|
||||
options = parser.parse_args()
|
||||
trigger_release(Path(options.payload), options.token)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -48,6 +48,7 @@ from _pytest.pathlib import bestrelpath
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import SupportsIndex
|
||||
from weakref import ReferenceType
|
||||
|
||||
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
|
||||
@@ -371,14 +372,16 @@ class Traceback(List[TracebackEntry]):
|
||||
return self
|
||||
|
||||
@overload
|
||||
def __getitem__(self, key: int) -> TracebackEntry:
|
||||
def __getitem__(self, key: "SupportsIndex") -> TracebackEntry:
|
||||
...
|
||||
|
||||
@overload
|
||||
def __getitem__(self, key: slice) -> "Traceback":
|
||||
...
|
||||
|
||||
def __getitem__(self, key: Union[int, slice]) -> Union[TracebackEntry, "Traceback"]:
|
||||
def __getitem__(
|
||||
self, key: Union["SupportsIndex", slice]
|
||||
) -> Union[TracebackEntry, "Traceback"]:
|
||||
if isinstance(key, slice):
|
||||
return self.__class__(super().__getitem__(key))
|
||||
else:
|
||||
|
||||
@@ -127,7 +127,7 @@ def pytest_cmdline_parse():
|
||||
|
||||
def showversion(config: Config) -> None:
|
||||
if config.option.version > 1:
|
||||
sys.stderr.write(
|
||||
sys.stdout.write(
|
||||
"This is pytest version {}, imported from {}\n".format(
|
||||
pytest.__version__, pytest.__file__
|
||||
)
|
||||
@@ -135,9 +135,9 @@ def showversion(config: Config) -> None:
|
||||
plugininfo = getpluginversioninfo(config)
|
||||
if plugininfo:
|
||||
for line in plugininfo:
|
||||
sys.stderr.write(line + "\n")
|
||||
sys.stdout.write(line + "\n")
|
||||
else:
|
||||
sys.stderr.write(f"pytest {pytest.__version__}\n")
|
||||
sys.stdout.write(f"pytest {pytest.__version__}\n")
|
||||
|
||||
|
||||
def pytest_cmdline_main(config: Config) -> Optional[Union[int, ExitCode]]:
|
||||
|
||||
@@ -626,7 +626,8 @@ class LoggingPlugin:
|
||||
finally:
|
||||
self.log_file_handler.release()
|
||||
if old_stream:
|
||||
old_stream.close()
|
||||
# https://github.com/python/typeshed/pull/5663
|
||||
old_stream.close() # type:ignore[attr-defined]
|
||||
|
||||
def _log_cli_enabled(self):
|
||||
"""Return whether live logging is enabled."""
|
||||
|
||||
@@ -484,7 +484,7 @@ class Session(nodes.FSCollector):
|
||||
|
||||
@classmethod
|
||||
def from_config(cls, config: Config) -> "Session":
|
||||
session: Session = cls._create(config)
|
||||
session: Session = cls._create(config=config)
|
||||
return session
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
||||
@@ -190,12 +190,12 @@ def deselect_by_keyword(items: "List[Item]", config: Config) -> None:
|
||||
return
|
||||
|
||||
if keywordexpr.startswith("-"):
|
||||
# To be removed in pytest 7.0.0.
|
||||
# To be removed in pytest 8.0.0.
|
||||
warnings.warn(MINUS_K_DASH, stacklevel=2)
|
||||
keywordexpr = "not " + keywordexpr[1:]
|
||||
selectuntil = False
|
||||
if keywordexpr[-1:] == ":":
|
||||
# To be removed in pytest 7.0.0.
|
||||
# To be removed in pytest 8.0.0.
|
||||
warnings.warn(MINUS_K_COLON, stacklevel=2)
|
||||
selectuntil = True
|
||||
keywordexpr = keywordexpr[:-1]
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import os
|
||||
import warnings
|
||||
from inspect import signature
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Callable
|
||||
from typing import cast
|
||||
from typing import Iterable
|
||||
from typing import Iterator
|
||||
from typing import List
|
||||
@@ -34,6 +36,7 @@ from _pytest.outcomes import fail
|
||||
from _pytest.pathlib import absolutepath
|
||||
from _pytest.pathlib import commonpath
|
||||
from _pytest.store import Store
|
||||
from _pytest.warning_types import PytestWarning
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# Imported here due to circular import.
|
||||
@@ -125,7 +128,20 @@ class NodeMeta(type):
|
||||
fail(msg, pytrace=False)
|
||||
|
||||
def _create(self, *k, **kw):
|
||||
return super().__call__(*k, **kw)
|
||||
try:
|
||||
return super().__call__(*k, **kw)
|
||||
except TypeError:
|
||||
sig = signature(getattr(self, "__init__"))
|
||||
known_kw = {k: v for k, v in kw.items() if k in sig.parameters}
|
||||
from .warning_types import PytestDeprecationWarning
|
||||
|
||||
warnings.warn(
|
||||
PytestDeprecationWarning(
|
||||
f"{self} is not using a cooperative constructor and only takes {set(known_kw)}"
|
||||
)
|
||||
)
|
||||
|
||||
return super().__call__(*k, **known_kw)
|
||||
|
||||
|
||||
class Node(metaclass=NodeMeta):
|
||||
@@ -539,26 +555,39 @@ def _check_initialpaths_for_relpath(session: "Session", path: Path) -> Optional[
|
||||
class FSCollector(Collector):
|
||||
def __init__(
|
||||
self,
|
||||
fspath: Optional[LEGACY_PATH],
|
||||
path: Optional[Path],
|
||||
parent=None,
|
||||
fspath: Optional[LEGACY_PATH] = None,
|
||||
path_or_parent: Optional[Union[Path, Node]] = None,
|
||||
path: Optional[Path] = None,
|
||||
name: Optional[str] = None,
|
||||
parent: Optional[Node] = None,
|
||||
config: Optional[Config] = None,
|
||||
session: Optional["Session"] = None,
|
||||
nodeid: Optional[str] = None,
|
||||
) -> None:
|
||||
if path_or_parent:
|
||||
if isinstance(path_or_parent, Node):
|
||||
assert parent is None
|
||||
parent = cast(FSCollector, path_or_parent)
|
||||
elif isinstance(path_or_parent, Path):
|
||||
assert path is None
|
||||
path = path_or_parent
|
||||
|
||||
path, fspath = _imply_path(path, fspath=fspath)
|
||||
name = path.name
|
||||
if parent is not None and parent.path != path:
|
||||
try:
|
||||
rel = path.relative_to(parent.path)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
name = str(rel)
|
||||
name = name.replace(os.sep, SEP)
|
||||
if name is None:
|
||||
name = path.name
|
||||
if parent is not None and parent.path != path:
|
||||
try:
|
||||
rel = path.relative_to(parent.path)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
name = str(rel)
|
||||
name = name.replace(os.sep, SEP)
|
||||
self.path = path
|
||||
|
||||
session = session or parent.session
|
||||
if session is None:
|
||||
assert parent is not None
|
||||
session = parent.session
|
||||
|
||||
if nodeid is None:
|
||||
try:
|
||||
@@ -570,7 +599,12 @@ class FSCollector(Collector):
|
||||
nodeid = nodeid.replace(os.sep, SEP)
|
||||
|
||||
super().__init__(
|
||||
name, parent, config, session, nodeid=nodeid, fspath=fspath, path=path
|
||||
name=name,
|
||||
parent=parent,
|
||||
config=config,
|
||||
session=session,
|
||||
nodeid=nodeid,
|
||||
path=path,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@@ -610,6 +644,20 @@ class Item(Node):
|
||||
|
||||
nextitem = None
|
||||
|
||||
def __init_subclass__(cls) -> None:
|
||||
problems = ", ".join(
|
||||
base.__name__ for base in cls.__bases__ if issubclass(base, Collector)
|
||||
)
|
||||
if problems:
|
||||
warnings.warn(
|
||||
f"{cls.__name__} is an Item subclass and should not be a collector, "
|
||||
f"however its bases {problems} are collectors.\n"
|
||||
"Please split the Collectors and the Item into separate node types.\n"
|
||||
"Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html\n"
|
||||
"example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/",
|
||||
PytestWarning,
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name,
|
||||
@@ -617,8 +665,16 @@ class Item(Node):
|
||||
config: Optional[Config] = None,
|
||||
session: Optional["Session"] = None,
|
||||
nodeid: Optional[str] = None,
|
||||
**kw,
|
||||
) -> None:
|
||||
super().__init__(name, parent, config, session, nodeid=nodeid)
|
||||
super().__init__(
|
||||
name=name,
|
||||
parent=parent,
|
||||
config=config,
|
||||
session=session,
|
||||
nodeid=nodeid,
|
||||
**kw,
|
||||
)
|
||||
self._report_sections: List[Tuple[str, str, str]] = []
|
||||
|
||||
#: A list of tuples (name, value) that holds user defined properties
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
anyio[curio,trio]==3.1.0
|
||||
anyio[curio,trio]==3.2.1
|
||||
django==3.2.4
|
||||
pytest-asyncio==0.15.1
|
||||
pytest-bdd==4.0.2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Generator
|
||||
from typing import List
|
||||
|
||||
import pytest
|
||||
@@ -44,52 +44,54 @@ class TestNewAPI:
|
||||
assert cache is not None
|
||||
cache.set("test/broken", [])
|
||||
|
||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="no chmod on windows")
|
||||
@pytest.fixture
|
||||
def unwritable_cache_dir(self, pytester: Pytester) -> Generator[Path, None, None]:
|
||||
cache_dir = pytester.path.joinpath(".pytest_cache")
|
||||
cache_dir.mkdir()
|
||||
mode = cache_dir.stat().st_mode
|
||||
cache_dir.chmod(0)
|
||||
if os.access(cache_dir, os.W_OK):
|
||||
pytest.skip("Failed to make cache dir unwritable")
|
||||
|
||||
yield cache_dir
|
||||
cache_dir.chmod(mode)
|
||||
|
||||
@pytest.mark.filterwarnings(
|
||||
"ignore:could not create cache path:pytest.PytestWarning"
|
||||
)
|
||||
def test_cache_writefail_permissions(self, pytester: Pytester) -> None:
|
||||
def test_cache_writefail_permissions(
|
||||
self, unwritable_cache_dir: Path, pytester: Pytester
|
||||
) -> None:
|
||||
pytester.makeini("[pytest]")
|
||||
cache_dir = pytester.path.joinpath(".pytest_cache")
|
||||
cache_dir.mkdir()
|
||||
mode = cache_dir.stat().st_mode
|
||||
cache_dir.chmod(0)
|
||||
try:
|
||||
config = pytester.parseconfigure()
|
||||
cache = config.cache
|
||||
assert cache is not None
|
||||
cache.set("test/broken", [])
|
||||
finally:
|
||||
cache_dir.chmod(mode)
|
||||
config = pytester.parseconfigure()
|
||||
cache = config.cache
|
||||
assert cache is not None
|
||||
cache.set("test/broken", [])
|
||||
|
||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="no chmod on windows")
|
||||
@pytest.mark.filterwarnings("default")
|
||||
def test_cache_failure_warns(
|
||||
self, pytester: Pytester, monkeypatch: MonkeyPatch
|
||||
self,
|
||||
pytester: Pytester,
|
||||
monkeypatch: MonkeyPatch,
|
||||
unwritable_cache_dir: Path,
|
||||
) -> None:
|
||||
monkeypatch.setenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", "1")
|
||||
cache_dir = pytester.path.joinpath(".pytest_cache")
|
||||
cache_dir.mkdir()
|
||||
mode = cache_dir.stat().st_mode
|
||||
cache_dir.chmod(0)
|
||||
try:
|
||||
pytester.makepyfile("def test_error(): raise Exception")
|
||||
result = pytester.runpytest()
|
||||
assert result.ret == 1
|
||||
# warnings from nodeids, lastfailed, and stepwise
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
# Validate location/stacklevel of warning from cacheprovider.
|
||||
"*= warnings summary =*",
|
||||
"*/cacheprovider.py:*",
|
||||
" */cacheprovider.py:*: PytestCacheWarning: could not create cache path "
|
||||
"{}/v/cache/nodeids".format(cache_dir),
|
||||
' config.cache.set("cache/nodeids", sorted(self.cached_nodeids))',
|
||||
"*1 failed, 3 warnings in*",
|
||||
]
|
||||
)
|
||||
finally:
|
||||
cache_dir.chmod(mode)
|
||||
|
||||
pytester.makepyfile("def test_error(): raise Exception")
|
||||
result = pytester.runpytest()
|
||||
assert result.ret == 1
|
||||
# warnings from nodeids, lastfailed, and stepwise
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
# Validate location/stacklevel of warning from cacheprovider.
|
||||
"*= warnings summary =*",
|
||||
"*/cacheprovider.py:*",
|
||||
" */cacheprovider.py:*: PytestCacheWarning: could not create cache path "
|
||||
f"{unwritable_cache_dir}/v/cache/nodeids",
|
||||
' config.cache.set("cache/nodeids", sorted(self.cached_nodeids))',
|
||||
"*1 failed, 3 warnings in*",
|
||||
]
|
||||
)
|
||||
|
||||
def test_config_cache(self, pytester: Pytester) -> None:
|
||||
pytester.makeconftest(
|
||||
|
||||
@@ -1756,7 +1756,7 @@ def test_help_and_version_after_argument_error(pytester: Pytester) -> None:
|
||||
assert result.ret == ExitCode.USAGE_ERROR
|
||||
|
||||
result = pytester.runpytest("--version")
|
||||
result.stderr.fnmatch_lines([f"pytest {pytest.__version__}"])
|
||||
result.stdout.fnmatch_lines([f"pytest {pytest.__version__}"])
|
||||
assert result.ret == ExitCode.USAGE_ERROR
|
||||
|
||||
|
||||
|
||||
@@ -7,16 +7,16 @@ def test_version_verbose(pytester: Pytester, pytestconfig, monkeypatch) -> None:
|
||||
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
|
||||
result = pytester.runpytest("--version", "--version")
|
||||
assert result.ret == 0
|
||||
result.stderr.fnmatch_lines([f"*pytest*{pytest.__version__}*imported from*"])
|
||||
result.stdout.fnmatch_lines([f"*pytest*{pytest.__version__}*imported from*"])
|
||||
if pytestconfig.pluginmanager.list_plugin_distinfo():
|
||||
result.stderr.fnmatch_lines(["*setuptools registered plugins:", "*at*"])
|
||||
result.stdout.fnmatch_lines(["*setuptools registered plugins:", "*at*"])
|
||||
|
||||
|
||||
def test_version_less_verbose(pytester: Pytester, pytestconfig, monkeypatch) -> None:
|
||||
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
|
||||
result = pytester.runpytest("--version")
|
||||
assert result.ret == 0
|
||||
result.stderr.fnmatch_lines([f"pytest {pytest.__version__}"])
|
||||
result.stdout.fnmatch_lines([f"pytest {pytest.__version__}"])
|
||||
|
||||
|
||||
def test_versions():
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Type
|
||||
|
||||
import pytest
|
||||
from _pytest import nodes
|
||||
from _pytest.compat import legacy_path
|
||||
from _pytest.pytester import Pytester
|
||||
from _pytest.warning_types import PytestWarning
|
||||
|
||||
@@ -39,6 +40,36 @@ def test_node_from_parent_disallowed_arguments() -> None:
|
||||
nodes.Node.from_parent(None, config=None) # type: ignore[arg-type]
|
||||
|
||||
|
||||
def test_subclassing_both_item_and_collector_deprecated(
|
||||
request, tmp_path: Path
|
||||
) -> None:
|
||||
"""
|
||||
Verifies we warn on diamond inheritance
|
||||
as well as correctly managing legacy inheritance ctors with missing args
|
||||
as found in plugins
|
||||
"""
|
||||
|
||||
with pytest.warns(
|
||||
PytestWarning,
|
||||
match=(
|
||||
"(?m)SoWrong is an Item subclass and should not be a collector, however its bases File are collectors.\n"
|
||||
"Please split the Collectors and the Item into separate node types.\n.*"
|
||||
),
|
||||
):
|
||||
|
||||
class SoWrong(nodes.File, nodes.Item):
|
||||
def __init__(self, fspath, parent):
|
||||
"""Legacy ctor with legacy call # don't wana see"""
|
||||
super().__init__(fspath, parent)
|
||||
|
||||
with pytest.warns(
|
||||
PytestWarning, match=".*SoWrong.* not using a cooperative constructor.*"
|
||||
):
|
||||
SoWrong.from_parent(
|
||||
request.session, fspath=legacy_path(tmp_path / "broken.txt")
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"warn_type, msg", [(DeprecationWarning, "deprecated"), (PytestWarning, "pytest")]
|
||||
)
|
||||
@@ -88,7 +119,7 @@ def test__check_initialpaths_for_relpath() -> None:
|
||||
|
||||
assert nodes._check_initialpaths_for_relpath(session, sub) == "file"
|
||||
|
||||
outside = Path("/outside")
|
||||
outside = Path("/outside-this-does-not-exist")
|
||||
assert nodes._check_initialpaths_for_relpath(session, outside) is None
|
||||
|
||||
|
||||
|
||||
7
tox.ini
7
tox.ini
@@ -149,13 +149,6 @@ deps =
|
||||
towncrier
|
||||
commands = python scripts/release.py {posargs}
|
||||
|
||||
[testenv:release-on-comment]
|
||||
decription = do a release from a comment on GitHub
|
||||
usedevelop = {[testenv:release]usedevelop}
|
||||
passenv = {[testenv:release]passenv}
|
||||
deps = {[testenv:release]deps}
|
||||
commands = python scripts/release-on-comment.py {posargs}
|
||||
|
||||
[testenv:prepare-release-pr]
|
||||
decription = prepare a release PR from a manual trigger in GitHub actions
|
||||
usedevelop = {[testenv:release]usedevelop}
|
||||
|
||||
Reference in New Issue
Block a user