Skip to content

Commit 1cf0413

Browse files
committed
Update doc/how-to/usage.rst
1 parent a413282 commit 1cf0413

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

doc/en/how-to/usage.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ in the current directory and its subdirectories. More generally, pytest follows
1717
Specifying which tests to run
1818
------------------------------
1919

20-
Pytest supports several ways to run and select tests from the command-line.
20+
Pytest supports several ways to run and select tests from the command-line or from a file
21+
(see below for :ref:`reading arguments from file <args-from-file>`).
2122

2223
**Run tests in a module**
2324

@@ -91,6 +92,26 @@ For more information see :ref:`marks <mark>`.
9192
9293
This will import ``pkg.testing`` and use its filesystem location to find and run tests from.
9394

95+
.. _args-from-file:
96+
97+
**Read arguments from file**
98+
99+
All of the above can be read from a file using the ``@`` prefix:
100+
101+
.. code-block:: bash
102+
103+
pytest @tests_to_run.txt
104+
105+
where ``tests_to_run.txt`` contains an entry per line, e.g.:
106+
107+
.. code-block:: text
108+
109+
tests/test_file.py
110+
tests/test_mod.py::test_func[x1,y2]
111+
tests/test_mod.py::TestClass
112+
-m slow
113+
114+
This file can also be generated using ``pytest --collect-only -q`` and modified as needed.
94115

95116
Getting help on version, option names, environment variables
96117
--------------------------------------------------------------

0 commit comments

Comments
 (0)