From d3552ef4c0770fe90e8a583d8fae9fd9280bca96 Mon Sep 17 00:00:00 2001 From: Uday Kumar Date: Fri, 28 Jul 2023 12:36:38 +0530 Subject: [PATCH] Clarify doc for running tests by nodeid section (#11249) --- doc/en/how-to/usage.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/en/how-to/usage.rst b/doc/en/how-to/usage.rst index 03afb22d6..65f9debd8 100644 --- a/doc/en/how-to/usage.rst +++ b/doc/en/how-to/usage.rst @@ -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