Add environment variables

This commit is contained in:
Bruno Oliveira 2018-03-06 20:40:07 -03:00
parent 18a47bfd22
commit c0fe4d483d
3 changed files with 42 additions and 1 deletions

View File

@ -169,7 +169,7 @@ class PytestPluginManager(PluginManager):
Overwrites :py:class:`pluggy.PluginManager <pluggy.PluginManager>` to add pytest-specific
functionality:
* loading plugins from the command line, ``PYTEST_PLUGIN`` env variable and
* loading plugins from the command line, ``PYTEST_PLUGINS`` env variable and
``pytest_plugins`` global variables found in plugins being loaded;
* ``conftest.py`` loading during start-up;
"""

View File

@ -766,6 +766,8 @@ and run it::
You'll see that the fixture finalizers could use the precise reporting
information.
.. _pytest current test env:
``PYTEST_CURRENT_TEST`` environment variable
--------------------------------------------

View File

@ -774,4 +774,43 @@ test functions and methods. Can be either a single mark or a sequence of marks.
import pytest
pytestmark = (pytest.mark.integration, pytest.mark.slow)
PYTEST_DONT_REWRITE (module docstring)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The text ``PYTEST_DONT_REWRITE`` can be add to any **module docstring** to disable
:ref:`assertion rewriting <assert introspection>` for that module.
Environment Variables
---------------------
Environment variables that can be used to change pytest's behavior.
PYTEST_ADDOPTS
~~~~~~~~~~~~~~
This contains a command-line (parsed by the py:mod:`shlex` module) that will be **prepended** to the command line given
by the user, see :ref:`adding default options` for more information.
PYTEST_DEBUG
~~~~~~~~~~~~
When set, pytest will print tracing and debug information.
PYTEST_PLUGINS
~~~~~~~~~~~~~~
Contains comma-separated list of modules that should be loaded as plugins:
.. code-block:: bash
export PYTEST_PLUGINS=mymodule.plugin,xdisst
PYTEST_CURRENT_TEST
~~~~~~~~~~~~~~~~~~~
This is not meant to be set by users, but is set by pytest internally with the name of the current test so other
processes can inspect it, see :ref:`pytest current test env` for more information.