need to run last as pytest_runtest_call, since it starts capturing

pull/30443/head
Shane Smiskol 2 years ago
parent f552952174
commit 26ef0684fc
  1. 13
      conftest.py

@ -12,10 +12,15 @@ def pytest_sessionstart(session):
session.config.option.randomly_reorganize = False
@pytest.fixture(scope="function", autouse=True)
def nocapture_fixture(caplog):
# print("nocapture_fixture")
with caplog.at_level(logging.CRITICAL + 1):
@pytest.hookimpl(hookwrapper=True, trylast=True)
def pytest_runtest_call(item):
# ensure we run as a hook after capturemanager's
capmanager = item.config.pluginmanager.getplugin("capturemanager")
if item.get_closest_marker("nocapture") is not None:
with capmanager.global_and_fixture_disabled():
yield
else:
yield

Loading…
Cancel
Save