Skip to content

Commit

Permalink
Merge pull request #2850 from bilderbuchi/docs-911
Browse files Browse the repository at this point in the history
Add documentation about python -m pytest invocation.
  • Loading branch information
nicoddemus authored Oct 18, 2017
2 parents 8c7974a + 46cc9ab commit 4cb60da
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/911.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add documentation about the ``python -m pytest`` invocation adding the current directory to sys.path.
5 changes: 5 additions & 0 deletions doc/en/pythonpath.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@ imported in the global import namespace.

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`.
2 changes: 1 addition & 1 deletion doc/en/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can invoke testing through the Python interpreter from the command line::
python -m 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
--------------------------------------------------------------
Expand Down

0 comments on commit 4cb60da

Please sign in to comment.