List of all tests associated with this marker in Pytest

In Pytest, we have a command pytest --markersthat lists all the tokens available for use.

However, I do not see a command to list the tests associated with the x marker. The documentation did not seem to cover this, so is this an opportunity in Pytest?

+4
source share
1 answer

Use --collect-onlyin combination with -m <marker>:

$ py.test --collect-only -m x
=========================== test session starts ===========================
platform linux -- Python 3.6.2, pytest-3.2.1, py-1.4.34, pluggy-0.4.0
rootdir: /home/they4kman/.virtualenvs/tmp-e1f1b42d6ff9bfa/src, inifile:
collected 3 items                                                          
<Module 'test_markers.py'>
  <Function 'test_x'>

====================== no tests ran in 0.00 seconds =======================
+6
source

Source: https://habr.com/ru/post/1683373/


All Articles