Merge pull request #2850 from bilderbuchi/docs-911

Add documentation about python -m pytest invocation.
This commit is contained in:
Bruno Oliveira 2017-10-18 19:44:52 -02:00 committed by GitHub
commit 4cb60dac3d
3 changed files with 7 additions and 1 deletions

1
changelog/911.doc Normal file
View File

@ -0,0 +1 @@
Add documentation about the ``python -m pytest`` invocation adding the current directory to sys.path.

View File

@ -68,4 +68,9 @@ imported in the global import namespace.
This is also discussed in details in :ref:`test discovery`. This is also discussed in details in :ref:`test discovery`.
Invoking ``pytest`` versus ``python -m pytest``
-----------------------------------------------
Running pytest with ``python -m pytest [...]`` instead of ``pytest [...]`` yields nearly
equivalent behaviour, except that the former call will add the current directory to ``sys.path``.
See also :ref:`cmdline`.

View File

@ -17,7 +17,7 @@ You can invoke testing through the Python interpreter from the command line::
python -m pytest [...] python -m pytest [...]
This is almost equivalent to invoking the command line script ``pytest [...]`` This is almost equivalent to invoking the command line script ``pytest [...]``
directly, except that Python will also add the current directory to ``sys.path``. directly, except that calling via ``python`` will also add the current directory to ``sys.path``.
Possible exit codes Possible exit codes
-------------------------------------------------------------- --------------------------------------------------------------