How can I show verbose py.test diffs without verbose test progress?
Unfortunately, there seems to be no configuration or command line flag for that, since that's hard-coded deep inside pytest: when you define --verbose
, you get the whole package. However, I've managed to come up with this hackish hack. Put the following function into your conftest.py
:
def pytest_configure(config):
terminal = config.pluginmanager.getplugin('terminal')
BaseReporter = terminal.TerminalReporter
class QuietReporter(BaseReporter):
def __init__(self, *args, **kwargs):
BaseReporter.__init__(self, *args, **kwargs)
self.verbosity = 0
self.showlongtestinfo = self.showfspath = False
terminal.TerminalReporter = QuietReporter
This is essentially a monkey-patching, relying on pytest internals, not guaranteed to be compatible with the future versions and ugly as sin. You can also make this patch conditional based on some other custom configuration of command-line argument.