Put @pytest.mark.<identifier> above the test method.
Run $ pytest -v -m <identifier>.
<indentifier> can be anything you choose.
For example, the a test file may look like this:
import pytest
@pytest.mark.focus
def first_test():
# do a test here
print('first test')
def second_test():
# do another test here
print('second test')
And then you can run the following command: pytest -v -m focus. first test should be printed to stdout, indicating only the first test was run.
Don’t forget to import pytest.
The -v flag will make the output more verbose so you can see everything that is going on.
The -m flag expects one argument: a mark expression. It will tell pytest to only run tests matching the identifier given.