-
Notifications
You must be signed in to change notification settings - Fork 182
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 optional django-silk #1809
Add optional django-silk #1809
Conversation
✅ Deploy Preview for fx-relay-demo canceled.
|
✅ Deploy Preview for fx-relay-demo canceled.
|
Silk is a live profiling and inspection tool for Django, suitable for local development. It is disabled when DEBUG=False. It is also disabled when running tests, since it adds database queries for writing profile data to the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: nice way to clean up code comments and make silk conditional! question on the IN_PYTEST
always-fail block.
# This needs to be before markus, which imports pytest | ||
IN_PYTEST = "pytest" in sys.modules | ||
if IN_PYTEST: | ||
assert 1==2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: I don't understand why we're doing this? This looks like it's just going to fail everything when we're "in pytest"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is because I didn't remove my test code from the PR 😅
Also, I should move this branch to the main repo so CI will run the tests.
Replaced by PR #1829. |
Silk is a live profiling and inspection tool for Django, suitable for local development. It is disabled when
DEBUG=False
. It is also disabled when running tests, since it adds database queries for writing profile data to the database, using the mechanism suggested at pytest-dev/pytest#9502.This is based on https://gist.github.com/groovecoder/5d2963d753cdfa690507a415b565dbaa
I'm not convinced we should add it by default, but if you want to use it, this makes it a lot easier.