Skip to content

Commit 06ff7ca

Browse files
github-actions[bot]antosikv
andauthoredJul 9, 2023
[7.4.x] Clarify docs for pytest.main default behavior (#11188)
Co-authored-by: antosikv <[email protected]>
1 parent 6dfe498 commit 06ff7ca

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎doc/en/how-to/usage.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ You can invoke ``pytest`` from Python code directly:
173173
174174
this acts as if you would call "pytest" from the command line.
175175
It will not raise :class:`SystemExit` but return the :ref:`exit code <exit-codes>` instead.
176-
You can pass in options and arguments:
176+
If you don't pass it any arguments, ``main`` reads the arguments from the command line arguments of the process (:data:`sys.argv`), which may be undesirable.
177+
You can pass in options and arguments explicitly:
177178

178179
.. code-block:: python
179180

‎src/_pytest/config/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ def main(
137137
) -> Union[int, ExitCode]:
138138
"""Perform an in-process test run.
139139
140-
:param args: List of command line arguments.
140+
:param args:
141+
List of command line arguments. If `None` or not given, defaults to reading
142+
arguments directly from the process command line (:data:`sys.argv`).
141143
:param plugins: List of plugin objects to be auto-registered during initialization.
142144
143145
:returns: An exit code.

0 commit comments

Comments
 (0)
Please sign in to comment.