Coverage for /usr/local/lib/python3.7/site-packages/_pytest/setupplan.py : 15%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import pytest
4def pytest_addoption(parser):
5 group = parser.getgroup("debugconfig")
6 group.addoption(
7 "--setupplan",
8 "--setup-plan",
9 action="store_true",
10 help="show what fixtures and tests would be executed but "
11 "don't execute anything.",
12 )
15@pytest.hookimpl(tryfirst=True)
16def pytest_fixture_setup(fixturedef, request):
17 # Will return a dummy fixture if the setuponly option is provided.
18 if request.config.option.setupplan:
19 my_cache_key = fixturedef.cache_key(request)
20 fixturedef.cached_result = (None, my_cache_key, None)
21 return fixturedef.cached_result
24@pytest.hookimpl(tryfirst=True)
25def pytest_cmdline_main(config):
26 if config.option.setupplan:
27 config.option.setuponly = True
28 config.option.setupshow = True