Skip to content

Commit 161ba87

Browse files
committed
doc/usage: clarify "Run tests by node ids"
Fix #11107, #11235.
1 parent f2b6040 commit 161ba87

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

doc/en/how-to/usage.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,28 @@ Use ``""`` instead of ``''`` in expression when running this on Windows
4646

4747
**Run tests by node ids**
4848

49-
Each collected test is assigned a unique ``nodeid`` which consist of the module filename followed
50-
by specifiers like class names, function names and parameters from parametrization, separated by ``::`` characters.
49+
Each collected test is assigned a unique ``nodeid`` which consist of the module file path followed
50+
by specifiers like class names and function names separated by ``::`` characters,
51+
and parameters from parametrization in ``[...]``.
52+
You can use the same syntax to match tests relative to the working directory.
5153

5254
To run a specific test within a module:
5355

5456
.. code-block:: bash
5557
56-
pytest test_mod.py::test_func
58+
pytest tests/test_mod.py::test_func
5759
60+
To run all tests in a class:
5861

59-
Another example specifying a test method in the command line:
62+
.. code-block:: bash
63+
64+
pytest tests/test_mod.py::TestClass
65+
66+
Specifying a specific test method:
6067

6168
.. code-block:: bash
6269
63-
pytest test_mod.py::TestClass::test_method
70+
pytest tests/test_mod.py::TestClass::test_method
6471
6572
**Run tests by marker expressions**
6673

0 commit comments

Comments
 (0)