Skip to content

Commit

Permalink
doc/usage: clarify "Run tests by node ids"
Browse files Browse the repository at this point in the history
  • Loading branch information
bluetech committed Jul 23, 2023
1 parent f2b6040 commit 161ba87
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions doc/en/how-to/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,28 @@ Use ``""`` instead of ``''`` in expression when running this on Windows

**Run tests by node ids**

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

To run a specific test within a module:

.. code-block:: bash
pytest test_mod.py::test_func
pytest tests/test_mod.py::test_func
To run all tests in a class:

Another example specifying a test method in the command line:
.. code-block:: bash
pytest tests/test_mod.py::TestClass
Specifying a specific test method:

.. code-block:: bash
pytest test_mod.py::TestClass::test_method
pytest tests/test_mod.py::TestClass::test_method
**Run tests by marker expressions**

Expand Down

0 comments on commit 161ba87

Please sign in to comment.