Skip to content

Commit 46cc9ab

Browse files
committed
Add documentation about python -m pytest invocation.
1 parent ae4e596 commit 46cc9ab

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

changelog/911.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add documentation about the ``python -m pytest`` invocation adding the current directory to sys.path.

doc/en/pythonpath.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,9 @@ imported in the global import namespace.
6868

6969
This is also discussed in details in :ref:`test discovery`.
7070

71+
Invoking ``pytest`` versus ``python -m pytest``
72+
-----------------------------------------------
7173

74+
Running pytest with ``python -m pytest [...]`` instead of ``pytest [...]`` yields nearly
75+
equivalent behaviour, except that the former call will add the current directory to ``sys.path``.
76+
See also :ref:`cmdline`.

doc/en/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You can invoke testing through the Python interpreter from the command line::
1717
python -m pytest [...]
1818

1919
This is almost equivalent to invoking the command line script ``pytest [...]``
20-
directly, except that Python will also add the current directory to ``sys.path``.
20+
directly, except that calling via ``python`` will also add the current directory to ``sys.path``.
2121

2222
Possible exit codes
2323
--------------------------------------------------------------

0 commit comments

Comments
 (0)