I can't find a way to list the tests which I can call with py.test -k PATTERN
How can I see the list of the available tests?
Run Multiple Tests From a Specific File and Multiple Files To run all the tests from all the files in the folder and subfolders we need to just run the pytest command. This will run all the filenames starting with test_ and the filenames ending with _test in that folder and subfolders under that folder.
pytest supports running Python unittest -based tests out of the box. It's meant for leveraging existing unittest -based test suites to use pytest as a test runner and also allow to incrementally adapt the test suite to take full advantage of pytest's features.
Pytest is a testing framework based on python. It is mainly used to write API test cases. This tutorial helps you understand − Installation of pytest. Various concepts and features of pytest.
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 --co
pytest --collect-only
You can use this flag among other flags, so in your case pytest --co -k PATTERN
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With