Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/en/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ pytest also introduces new options:
a string! This means that it may not be appropriate to enable globally in
``doctest_optionflags`` in your configuration file.

.. versionadded:: 5.1


Continue on failure
-------------------
Expand Down
4 changes: 4 additions & 0 deletions doc/en/fixture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,13 @@ are finalized when the last test of a *package* finishes.
Use this new feature sparingly and please make sure to report any issues you find.


.. _dynamic scope:

Dynamic scope
^^^^^^^^^^^^^

.. versionadded:: 5.2

In some cases, you might want to change the scope of the fixture without changing the code.
To do that, pass a callable to ``scope``. The callable must return a string with a valid scope
and will be executed only once - during the fixture definition. It will be called with two
Expand Down
5 changes: 5 additions & 0 deletions doc/en/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ for example ``-x`` if you only want to send one particular failure.

Currently only pasting to the http://bpaste.net service is implemented.

.. versionchanged:: 5.2

If creating the URL fails for any reason, a warning is generated instead of failing the
entire test suite.

Early loading plugins
---------------------

Expand Down
2 changes: 2 additions & 0 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ class Config:
class InvocationParams:
"""Holds parameters passed during ``pytest.main()``

.. versionadded:: 5.1

.. note::

Currently the environment variable PYTEST_ADDOPTS is also handled by
Expand Down
8 changes: 6 additions & 2 deletions src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,9 +1088,13 @@ def fixture(

:arg scope: the scope for which this fixture is shared, one of
``"function"`` (default), ``"class"``, ``"module"``,
``"package"`` or ``"session"``.
``"package"`` or ``"session"`` (``"package"`` is considered **experimental**
at this time).

``"package"`` is considered **experimental** at this time.
This parameter may also be a callable which receives ``(fixture_name, config)``
as parameters, and must return a ``str`` with one of the values mentioned above.

See :ref:`dynamic scope` in the docs for more information.

:arg params: an optional list of parameters which will cause multiple
invocations of the fixture function and all of the tests
Expand Down
2 changes: 2 additions & 0 deletions src/_pytest/hookspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ def pytest_assertion_pass(item, lineno, orig, expl):
"""
**(Experimental)**

.. versionadded:: 5.0

Hook called whenever an assertion *passes*.

Use this hook to do some processing after a passing assertion.
Expand Down
2 changes: 2 additions & 0 deletions src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

class ExitCode(enum.IntEnum):
"""
.. versionadded:: 5.0

Encodes the valid exit codes by pytest.

Currently users and plugins may supply other exit codes as well.
Expand Down