Remove test warnings & logline, prevent introducing them again in the future#684
Conversation
|
✔️ Deploy Preview for pydis-static ready! 🔨 Explore the source changes: 2734a68 🔍 Inspect the deploy log: https://app.netlify.com/sites/pydis-static/deploys/621fbb854245670007fafb91 😎 Browse the preview: https://deploy-preview-684--pydis-static.netlify.app |
| # Prevent verbose warnings emitted when passing a non-timezone aware | ||
| # datetime object to the database, whilst we have time zone support | ||
| # active. See the Django documentation for more details: | ||
| # https://docs.djangoproject.com/en/dev/topics/i18n/timezones/ | ||
| warnings.filterwarnings( | ||
| 'error', r"DateTimeField .* received a naive datetime", | ||
| RuntimeWarning, r'django\.db\.models\.fields', | ||
| ) |
There was a problem hiding this comment.
Wait wait wait, I don't get it. You're solving this problem so that we're passing timezone-aware objects, right? Why do we then still need to surpress the warnings?
There was a problem hiding this comment.
this isn't suppressing them, this is basically saying "error out instead of warning for this message from that warning from that module", so it raises that instead of printing the warning
There was a problem hiding this comment.
this is a win, and we are all part of it.
There was a problem hiding this comment.
ohhh. It'll raise a RuntimeWarning instead of silently warning, that's the thing?
Okay, I like it, but maybe we can improve the comment a little bit?
There was a problem hiding this comment.
nonononono, it will raise an error because it got that runtime warning, that's why I pass 'error' as the first argument. I actually stole this, I did not write it myself
Add a `warnings.warnings` clause to prevent these from being raised again in the future, and raise a full traceback if they don't.
b78bdd0 to
2734a68
Compare
Closes #671