# FlexibleTerminalReporter is imported for backward compatibility;
# it should be imported from pytest_store
from fixtures.pytest_store import store
from cfme.utils import diaper
from cfme.utils.log import logger
[docs]def reporter(config=None):
"""Return a py.test terminal reporter that will write to the console no matter what
Only useful when trying to write to the console before or during a
:py:func:`pytest_configure <pytest:_pytest.hookspec.pytest_configure>` hook.
"""
# config arg is accepted, but no longer needed thanks to pytest_store, so it is ignored
return store.terminalreporter
[docs]def disable():
# Cloud be a FlexibleTerminalReporter, which is a subclass of TerminalReporter,
# so match the type directly
with diaper:
store.pluginmanager.unregister(store.terminalreporter)
logger.debug('terminalreporter disabled')
[docs]def enable():
with diaper:
store.pluginmanager.register(store.terminalreporter, 'terminalreporter')
logger.debug('terminalreporter enabled')