Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tadeoos committed Aug 16, 2018
1 parent fe73969 commit 51b3e66
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
22 changes: 12 additions & 10 deletions doc/en/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ Here is the algorithm which finds the rootdir from ``args``:
recognised as paths that exist in the file system. If no such paths are
found, the common ancestor directory is set to the current working directory.

- look for ``pytest.ini``, ``tox.ini`` and ``setup.cfg`` files in the ancestor
directory and upwards. If one is matched, it becomes the ini-file and its
directory becomes the rootdir.
- look for ``pytest.ini``, ``tox.ini``, ``setup.cfg`` and ``pyproject.toml``
files in the ancestor directory and upwards. If one is matched, it becomes
the ini-file and its directory becomes the rootdir.

- if no ini-file was found, look for ``setup.py`` upwards from the common
ancestor directory to determine the ``rootdir``.

- if no ``setup.py`` was found, look for ``pytest.ini``, ``tox.ini`` and
``setup.cfg`` in each of the specified ``args`` and upwards. If one is
- if no ``setup.py`` was found, look for ``pytest.ini``, ``tox.ini``, ``setup.cfg``
and ``pyproject.toml`` in each of the specified ``args`` and upwards. If one is
matched, it becomes the ini-file and its directory becomes the rootdir.

- if no ini-file was found, use the already determined common ancestor as root
Expand All @@ -77,10 +77,11 @@ directory and also starts determining the rootdir from there.
possible.

Note that an existing ``pytest.ini`` file will always be considered a match,
whereas ``tox.ini`` and ``setup.cfg`` will only match if they contain a
``[pytest]`` or ``[tool:pytest]`` section, respectively. Options from multiple ini-files candidates are never
merged - the first one wins (``pytest.ini`` always wins, even if it does not
contain a ``[pytest]`` section).
whereas ``tox.ini``, ``setup.cfg`` and ``pyproject.toml`` will only match if
they contain a ``[pytest]``, ``[tool:pytest]`` or ``[tool.pytest]`` section,
respectively. Options from multiple ini-files candidates are never merged -
the first one wins (``pytest.ini`` always wins, even if it does not contain
a ``[pytest]`` section).

The ``config`` object will subsequently carry these attributes:

Expand All @@ -101,6 +102,7 @@ check for ini-files as follows::

# first look for pytest.ini files
path/pytest.ini
path/pyproject.toml # must also contain [tool.pytest] section to match
path/setup.cfg # must also contain [tool:pytest] section to match
path/tox.ini # must also contain [pytest] section to match
pytest.ini
Expand Down Expand Up @@ -128,7 +130,7 @@ progress output, you can write it into a configuration file:
.. code-block:: ini
# content of pytest.ini
# (or tox.ini or setup.cfg)
# (or tox.ini or setup.cfg or pyproject.toml)
[pytest]
addopts = -ra -q
Expand Down
4 changes: 2 additions & 2 deletions doc/en/example/pythoncollection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ the :confval:`python_files`, :confval:`python_classes` and
:confval:`python_functions` configuration options. Example::

# content of pytest.ini
# can also be defined in tox.ini or setup.cfg file, although the section
# name in setup.cfg files should be "tool:pytest"
# can also be defined in tox.ini, setup.cfg or pyproject.toml file, although the section
# name in setup.cfg files should be "tool:pytest" or "tool.pytest" in pyproject.toml files
[pytest]
python_files=check_*.py
python_classes=Check
Expand Down
8 changes: 4 additions & 4 deletions doc/en/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,9 @@ processes can inspect it, see :ref:`pytest current test env` for more informatio
Configuration Options
---------------------

Here is a list of builtin configuration options that may be written in a ``pytest.ini``, ``tox.ini`` or ``setup.cfg``
file, usually located at the root of your repository. All options must be under a ``[pytest]`` section
(``[tool:pytest]`` for ``setup.cfg`` files).
Here is a list of builtin configuration options that may be written in a ``pytest.ini``, ``tox.ini``, ``setup.cfg``
or ``pyproject.toml`` file, usually located at the root of your repository. All options must be under a ``[pytest]``
section (``[tool:pytest]`` for ``setup.cfg`` or ``[tool.pytest]`` for ``pyproject.toml`` files).

Configuration file options may be overwritten in the command-line by using ``-o/--override``, which can also be
passed multiple times. The expected format is ``name=value``. For example::
Expand Down Expand Up @@ -928,7 +928,7 @@ passed multiple times. The expected format is ``name=value``. For example::

Sets a directory where search upwards for ``conftest.py`` files stops.
By default, pytest will stop searching for ``conftest.py`` files upwards
from ``pytest.ini``/``tox.ini``/``setup.cfg`` of the project if any,
from ``pytest.ini``/``tox.ini``/``setup.cfg``/``pyproject.toml`` of the project if any,
or up to the file-system root.


Expand Down

0 comments on commit 51b3e66

Please sign in to comment.