From 46cc9ab77c5e04fbb6c8b06688b8a41b686d3c97 Mon Sep 17 00:00:00 2001 From: Christoph Buchner Date: Wed, 18 Oct 2017 21:30:56 +0200 Subject: [PATCH] Add documentation about python -m pytest invocation. --- changelog/911.doc | 1 + doc/en/pythonpath.rst | 5 +++++ doc/en/usage.rst | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/911.doc diff --git a/changelog/911.doc b/changelog/911.doc new file mode 100644 index 00000000000..e9d94f21ce8 --- /dev/null +++ b/changelog/911.doc @@ -0,0 +1 @@ +Add documentation about the ``python -m pytest`` invocation adding the current directory to sys.path. diff --git a/doc/en/pythonpath.rst b/doc/en/pythonpath.rst index 67de7f5d2ca..b6474276887 100644 --- a/doc/en/pythonpath.rst +++ b/doc/en/pythonpath.rst @@ -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`. diff --git a/doc/en/usage.rst b/doc/en/usage.rst index a8c6d40a027..c5b919fe9eb 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -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 --------------------------------------------------------------