Clarify doc for running tests by nodeid section (#11249)

This commit is contained in:
Uday Kumar 2023-07-28 12:36:38 +05:30 committed by GitHub
parent 448563caaa
commit d3552ef4c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -44,12 +44,10 @@ Use ``""`` instead of ``''`` in expression when running this on Windows
.. _nodeids:
**Run tests by node ids**
**Run tests by collection arguments**
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.
Pass the module filename relative to the working directory, followed by specifiers like the class name and function name
separated by ``::`` characters, and parameters from parameterization enclosed in ``[]``.
To run a specific test within a module:
@ -69,6 +67,12 @@ Specifying a specific test method:
pytest tests/test_mod.py::TestClass::test_method
Specifying a specific parametrization of a test:
.. code-block:: bash
pytest tests/test_mod.py::test_func[x1,y2]
**Run tests by marker expressions**
.. code-block:: bash