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
Set TerminalWriter instance in workers outputs to /dev/null
In commit 76bcb8f "Unregister terminalreporter in workers", we
unregister terminalreporter plugin in the workers to avoid duplicated
prints.
However, since pytest.git commit fbe3e29 "Color the full diff that
pytest shows as a diff", `assertrepr_compare` method now consume
terminalreporter to inject the characters that control text colour and
highlighting. Before the commit, pytest seems to have tolerated a
missing terminalreporter which is not the case anymore.
In this patch, we solve the issue by taking an alternative approach to
fix the duplicated prints. Instead of unregistering the plugin, we
sneakily replace the TerminalWriter instance of the plugin, using one
that writes to /dev/null instead of stdout. There are probably more
elegant ways to address the issue, but at the origin of the problem
there is pytest making use of the same class private field we are
overwriting. Furthermore, there are plans to make changes around
TerminalWriter (pytest-dev/pytest#10436), so
any heavyweight solution seems to be a potential waste of time.
0 commit comments