August 2018
Beginner
160 pages
4h 8m
English
We can also apply a mark to all test functions and test classes in a module. Just declare a global variable named pytestmark:
import pytestpytestmark = pytest.mark.timeout(10)class TestCore: def test_simple_simulation(self): ...def test_compute_tracers(): ...
The following is the equivalent to this:
import pytest@pytest.mark.timeout(10)class TestCore: def test_simple_simulation(self): ...@pytest.mark.timeout(10)def test_compute_tracers(): ...
You can use a tuple or list of marks to apply multiple marks as well:
import pytestpytestmark = [pytest.mark.slow, pytest.mark.timeout(10)]
Read now
Unlock full access