Added details about PYTEST_VERSION to doc/en/reference/reference.rst

This commit is contained in:
dheerajck 2024-04-07 19:28:38 +05:30
parent 237ea1ac23
commit d6d59fed41
1 changed files with 5 additions and 0 deletions

View File

@ -1117,6 +1117,11 @@ When set (regardless of value), pytest acknowledges that is running in a CI proc
This contains a command-line (parsed by the py:mod:`shlex` module) that will be **prepended** to the command line given 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. by the user, see :ref:`adding default options` for more information.
.. envvar:: PYTEST_VERSION
This environment variable is defined at the start of the pytest session and is undefined afterwards.
It contains the value of ``pytest.__version__``, and among other things can be used to easily check if a code is running from within a pytest run.
.. envvar:: PYTEST_CURRENT_TEST .. envvar:: 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 This is not meant to be set by users, but is set by pytest internally with the name of the current test so other