Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions doc/en/example/pythoncollection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,24 @@ Now a simple invocation of ``pytest NAME`` will check
if NAME exists as an importable package/module and otherwise
treat it as a filesystem path.

Choosing between ``--pyargs`` and ``testpaths``
--------------------------------------------

The :option:`--pyargs` option and the :confval:`testpaths` configuration setting
control different parts of test collection:

* ``--pyargs`` interprets the arguments that follow it as importable package or
module names and resolves them to filesystem paths. This is useful when the
tests are installed as a package.
* ``testpaths`` lists filesystem paths, relative to the :ref:`rootdir <rootdir>`,
that pytest searches when no test paths or test identifiers are supplied on
the command line.

``testpaths`` does not change how an explicitly supplied argument is resolved.
If you want to pass package names explicitly, use ``--pyargs`` for that
invocation. Conversely, a project that runs tests from its source tree can use
``testpaths`` without installing the project first.

Finding out what is collected
-----------------------------------------------

Expand Down