From c0fe4d483d6356b0fb6b2dc5e2e06792e866b726 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 6 Mar 2018 20:40:07 -0300 Subject: [PATCH] Add environment variables --- _pytest/config.py | 2 +- doc/en/example/simple.rst | 2 ++ doc/en/reference.rst | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/_pytest/config.py b/_pytest/config.py index 359cc4bc8..e8bfeccb4 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -169,7 +169,7 @@ class PytestPluginManager(PluginManager): Overwrites :py:class:`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; """ diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 1b1cb829c..b044f43ad 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -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 -------------------------------------------- diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 6a39f7542..3086f9be7 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -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 ` 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. +