jazzband / django-debug-toolbar

A configurable set of panels that display various debug information about the current request/response.
https://django-debug-toolbar.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
7.97k stars 1.03k forks source link

Add a section to the installation docs about running tests #1921

Closed matthiask closed 1 month ago

matthiask commented 1 month ago

Fixes #1920.

I thought about including the relevant documentation in the earlier steps, but I'd have to explain DEBUG, INTERNAL_IPS and TESTING all at once instead of introducing everything step by step. So even though it may be annoying to go back and modify code the user just added it still reads better to me, especially since it only applies to users running tests in their project. (I would hope a lot of them do, but still.)

Checklist:

tim-schilling commented 1 month ago

I don't think this was necessary. The docs point the user to the example app in the repo.

tim-schilling commented 1 month ago

Check out the configuration example in the example app to learn how to set up the toolbar to function smoothly while running your tests.

matthiask commented 1 month ago

I'm not so sure. The example contains many aspects and the test suite thing is just one of them. The question arrived really quickly and I thought I'd lean towards more docs. Maybe the section could be shortened somewhat or people could be made aware of the problem in ways which are shorter than the current version but maybe still more visible than what we had before?

tim-schilling commented 1 month ago

I feel like there's a better installation process with AppConfig.ready and the middleware where we could check DEBUG after the Django test runner does its magic.

matthiask commented 1 month ago

Definitely sounds interesting. One of my first big(ger) decisions in this project was to remove the magical installation, so I'm a bit wary, but AppConfig.ready sounds like a good way to opt into some behaviors.

tim-schilling commented 1 month ago

Ah we may have a difference of opinion then. I feel like asking a person to add any if statements to their apps configuration is a shortcoming of the project.

matthiask commented 1 month ago

Yes, maybe :-)

I lean towards the "worse is better" school of software design where it's slightly better to be simple than to be correct. I think that everything breaks down at a point, and if the implementation is simple it will be easier to understand and fix (or work around) than if the implementation is complex.

That being said, I like Django a lot and its implementation certainly isn't simple. So it really depends. As long as we can put behaviors into parts which can be easily replaced and which have a small API I'm fine with it. The show_toolbar(request) -> bool callback is a great example of this.

Also, I won't stand in the way since it's not my personal project after all!