@@ -46,24 +46,18 @@ Plugin discovery order at tool startup
46
46
47
47
5. by loading all plugins specified through the :envvar: `PYTEST_PLUGINS ` environment variable.
48
48
49
- 6. by loading all :file: `conftest.py ` files as inferred by the command line
50
- invocation:
49
+ 6. by loading all "initial ":file: `conftest.py ` files:
51
50
52
- - if no test paths are specified, use the current dir as a test path
53
- - if exists, load ``conftest.py `` and ``test*/conftest.py `` relative
54
- to the directory part of the first test path. After the ``conftest.py ``
55
- file is loaded, load all plugins specified in its
56
- :globalvar: `pytest_plugins ` variable if present.
51
+ - determine the test paths: specified on the command line, otherwise in
52
+ :confval: `testpaths ` if defined and running from the rootdir, otherwise the
53
+ current dir
54
+ - for each test path, load ``conftest.py `` and ``test*/conftest.py `` relative
55
+ to the directory part of the test path, if exist. Before a ``conftest.py ``
56
+ file is loaded, load ``conftest.py `` files in all of its parent directories.
57
+ After a ``conftest.py `` file is loaded, recursively load all plugins specified
58
+ in its :globalvar: `pytest_plugins ` variable if present.
57
59
58
- Note that pytest does not find ``conftest.py `` files in deeper nested
59
- sub directories at tool startup. It is usually a good idea to keep
60
- your ``conftest.py `` file in the top level test or project root directory.
61
60
62
- 7. by recursively loading all plugins specified by the
63
- :globalvar: `pytest_plugins ` variable in ``conftest.py `` files.
64
-
65
-
66
- .. _`pytest/plugin` : http://bitbucket.org/pytest-dev/pytest/src/tip/pytest/plugin/
67
61
.. _`conftest.py plugins` :
68
62
.. _`localplugin` :
69
63
.. _`local conftest plugins` :
@@ -108,9 +102,9 @@ Here is how you might run it::
108
102
See also: :ref: `pythonpath `.
109
103
110
104
.. note ::
111
- Some hooks should be implemented only in plugins or conftest.py files situated at the
112
- tests root directory due to how pytest discovers plugins during startup,
113
- see the documentation of each hook for details.
105
+ Some hooks cannot be implemented in conftest.py files which are not
106
+ :ref: ` initial < pluginorder >` due to how pytest discovers plugins during
107
+ startup. See the documentation of each hook for details.
114
108
115
109
Writing your own plugin
116
110
-----------------------
0 commit comments