-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce new hook to better control display of items in terminal #5047
Comments
Sounds good! |
Could use a more specific name, terminalwriter options and more general options need a sane way to communicate In particular for other ux systems (im hoping for eventually a html5/electron ux integrated with looponfail, xdist and tox |
@RonnyPfannschmidt I thought about using "terminal" in the name, but realized that other plugins will want to call this hook, just from the top of my head junitxml and pytest-html; they will be interested to use I'm open to other naming suggestions, but "terminal" specifically doesn't seem like a good fit for the reasons mentioned above. |
@nicoddemus we basically have something that begs for polymorphism, multi-methods or generic methods, any easy solution will have weird edges |
@RonnyPfannschmidt can you elaborate? It is not clear from your answer if it is a suggestion, a 👎 for my proposal, or just musings for the future. 😁 |
Future musing and a -0 |
OK, thanks. I plan to go ahead with this anyway given you are not a strong -1; I believe it will help cleanup the terminal code off the xdist-specific code, and provide more flexibility for existing plugins. Anyway I will mark it off as experimental, so that a limited number of plugins and the core should use it and provide feedback. |
With regard to #5122 I think it might make sense to have these as properties/methods on the BaseReport also, which allows to customize/override it from there. (My current use case is adjusting the verbose name ( |
Something similar might make sense also with "displaying objects" in assertion rewriting / tb-locals etc. |
Recently I have added
TestReport.count_towards_summary
andTestReport.head_line
properties as a way to control how items are shown/handled by the terminal plugin. After some feedback it is clear that I would need to customize other things as well.The current approach of adding a property to
TestReport
so it can be overwritten by subclasses in plugins is sub-optimal: it requires access to the privateTestReport
class to declare it in the bases list of the subclass, and subclasses in general are not a good way to extend plugins functionality in plugins traditionally as they expose too much internal details.I propose then that we add a new hook:
A big advantage here is that it is easy to extend the customizability of how reports are displayed in the
future, without introducing new hooks or breaking backward compatibility. Also it will allow us to get rid of
xdist-specific code in the terminal plugin, as we will be able to delegate the decisions to the hook.
Thoughts?
cc @RonnyPfannschmidt
The text was updated successfully, but these errors were encountered: