Listing all tests associated with a given marker in Pytest

Viewed 2322

In Pytest we have the pytest --markers command which will list all of the markers that are available for use.

However, I am not seeing a command to list tests associated with x marker. The documentation didn't appear to cover this so is this a possibility in Pytest?

2 Answers

A more cleaner output can be achieved by using:

(spark_pytest) ALIPL0958:Spark_pytest kapilmathur$ pytest -m integration --collect-only -qq


tests/Servers/test_server_rebuild.py::TestRebuildWithVolumes::test_rebuild_with_volume_attached
tests/Servers/test_server_rebuild.py::TestRebuildWithVolumes::test_post_rebuild_with_second_volume_attach
tests/Servers/test_server_resize.py::TestResizeWithVolumes::test_resize_with_volume_attached
tests/Servers/test_server_resize.py::TestResizeWithVolumes::test_post_resize_with_second_volume_attach

enter image description here

Related