Skip to content
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

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

Merged
merged 4 commits into from
May 27, 2024

Conversation

matthiask
Copy link
Member

@matthiask matthiask commented May 27, 2024

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:

  • I have added the relevant tests for this change.
  • I have added an item to the Pending section of docs/changes.rst.

@matthiask matthiask requested a review from VeldaKiara May 27, 2024 08:39
docs/installation.rst Outdated Show resolved Hide resolved
Fixes django-commons#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.)
@matthiask matthiask merged commit f7e83b1 into django-commons:main May 27, 2024
25 checks passed
@matthiask matthiask deleted the issue-1920 branch May 27, 2024 10:50
@tim-schilling
Copy link
Member

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

@tim-schilling
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member

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
Copy link
Member Author

matthiask commented May 27, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error after update to 4.4.1 (debug_toolbar.E001) The Django Debug Toolbar can't be used with tests
3 participants