You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My use case is that I would like to unregister the terminal reporter and display only output from my plugin (I'm trying to stream Test Anything Protocol output directly from py.test). Unless I disable terminalreporter from the command line with -p no:terminalreporter, I am not able to suppress terminal reporter output.
I see that the terminal reporter isn't registered until terminal.py has its pytest_configure hook invoked, but since terminal.py is a built-in, I don't understand why the plugin is not available downstream in the conftest.py plugin.
I am running pytest 2.7.2 with Python 2.7.6 on Ubuntu 14.04. Thanks for reading this far! 😄
The text was updated successfully, but these errors were encountered:
(Note that says terminal as opposed to terminalreporter).
That's because while the terminal plugin is loaded at that point, the terminal plugin installs terminalreporter exactly by implementing a pytest_configure hook:
So what's happening is that your conftest's pytest_configure is being called before terminal's pytest_configure. The simplest solution is just to ask pytest to call your hook as late as possible:
The documentation indicates that plugins should be able to interact with other plugins via
config.pluginmanager.getplugin(name)
.The
pytest_configure
hook documentation reads (emphasis added):And the order for plugin discovery is supposed to be built-ins, setuptools plugins, command line declared plugins, and conftest plugins.
In spite of that, I am unable to get the
terminalreporter
plugin in mypytest_configure
hook.Here is a basic
conftest.py
plugin to demonstrate the problem:My use case is that I would like to unregister the terminal reporter and display only output from my plugin (I'm trying to stream Test Anything Protocol output directly from py.test). Unless I disable
terminalreporter
from the command line with-p no:terminalreporter
, I am not able to suppress terminal reporter output.I see that the terminal reporter isn't registered until
terminal.py
has itspytest_configure
hook invoked, but sinceterminal.py
is a built-in, I don't understand why the plugin is not available downstream in theconftest.py
plugin.I am running pytest 2.7.2 with Python 2.7.6 on Ubuntu 14.04. Thanks for reading this far! 😄
The text was updated successfully, but these errors were encountered: