List available tests with py.test

You can also use --collect-only, this will show a tree-like structure of the collected nodes. Usually one can simply -k on the names of the Function nodes.


You should use the flag --collect-only. If you are using pytest 5.3.0 or newer use --co.

pytest 5.3.0+

pytest --co

previous versions

pytest --collect-only

You can use this flag among other flags, so in your case pytest --co -k PATTERN.