Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation about python -m pytest invocation. #2850

Merged
merged 1 commit into from
Oct 18, 2017
Merged
Show file tree
Hide file tree
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
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