Skip to content

Commit eb08135

Browse files
davehuntblueyed
authored andcommitted
Update documentation to describe expected rootdir behaviour
1 parent a289142 commit eb08135

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

doc/en/customize.rst

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,29 @@ project/testrun-specific information.
2929

3030
Here is the algorithm which finds the rootdir from ``args``:
3131

32-
- determine the common ancestor directory for the specified ``args``.
32+
- determine the common ancestor directory for the specified ``args`` that are
33+
recognised as paths that exist in the file system. If no such paths are
34+
found, the common ancestor directory is set to the current working directory.
3335

34-
- look for ``pytest.ini``, ``tox.ini`` and ``setup.cfg`` files in the
35-
ancestor directory and upwards. If one is matched, it becomes the
36-
ini-file and its directory becomes the rootdir. An existing
37-
``pytest.ini`` file will always be considered a match whereas
38-
``tox.ini`` and ``setup.cfg`` will only match if they contain
39-
a ``[pytest]`` section.
36+
- look for ``pytest.ini``, ``tox.ini`` and ``setup.cfg`` files in the ancestor
37+
directory and upwards. If one is matched, it becomes the ini-file and its
38+
directory becomes the rootdir.
4039

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

44-
- if no ini-file and no ``setup.py`` was found, use the already
45-
determined common ancestor as root directory. This allows to
46-
work with pytest in structures that are not part of a package
47-
and don't have any particular ini-file configuration.
43+
- if no ``setup.py`` was found, look for ``pytest.ini``, ``tox.ini`` and
44+
``setup.cfg`` in each of the specified ``args`` and upwards. If one is
45+
matched, it becomes the ini-file and its directory becomes the rootdir.
4846

49-
Note that options from multiple ini-files candidates are never merged,
50-
the first one wins (``pytest.ini`` always wins even if it does not
47+
- if no ini-file was found, use the already determined common ancestor as root
48+
directory. This allows to work with pytest in structures that are not part of
49+
a package and don't have any particular ini-file configuration.
50+
51+
Note that an existing ``pytest.ini`` file will always be considered a match,
52+
whereas ``tox.ini`` and ``setup.cfg`` will only match if they contain a
53+
``[pytest]`` section. Options from multiple ini-files candidates are never
54+
merged - the first one wins (``pytest.ini`` always wins, even if it does not
5155
contain a ``[pytest]`` section).
5256

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

0 commit comments

Comments
 (0)