I'm debugging one test which fails. Is there a way to mark only one test to run?
something like:
@pytest.only # it doesn't work
def test_some_test():
...
I'm debugging one test which fails. Is there a way to mark only one test to run?
something like:
@pytest.only # it doesn't work
def test_some_test():
...
You can mark your test with pytest.mark
. The mark is dynamically created, so you can choose almost any name. Here is a link to docs.
For example in tt.py
:
import pytest
@pytest.mark.one_test
def test_foo():
assert 1 == 1
def test_bar():
assert 2 == 2
enter code here
and then run with pytest tt.py -m one_test
:
pytest tt.py -m one_test
======================= test session starts =========================
platform darwin -- Python 3.6.3, pytest-3.6.1, py-1.5.3, pluggy-0.6.0
rootdir: /Users/foobarna/workspace/random, inifile:
collected 2 items / 1 deselected
tt.py .
[100%]
============= 1 passed, 1 deselected in 0.04 seconds ================