Investigating
https://code.djangoproject.com/ticket/21163I came across these lines in mysql/base.py:
if settings.DEBUG:
warnings.filterwarnings("error", category=Database.Warning)
Finding out why, this bubbles up to somewhere in 2007
https://github.com/django/django/commit/f9c4ce51235aac4862cfe2dfaaf6836acaea1c3dI can't find the reason why this behaviour is in, other than the comments in de commit mentioned before: "Since the point is to raise Warnings as exception"..
No arguments here.. Is there someone who actually knows the reasons?
It seems this code comes from the old MySQL days (pre 5/5.1) and a lot has changed since in MySQL since then.
However.. I think in DEBUG mode these warning should be shown as warnings as they are warnings :-) an not being promoted to Exceptions.
Maybe even _every_ warning should be shown and not only the first one. The example in the bug-report is about data-truncation.
It's not something like a deprecation warning.
Coming to a conclusion _IMHO_ the different behaviour between debug mode or not is somehow strange.
The behaviour should be either promote warning to exceptions in DEBUG=False (production) too, but that probably breaks a lot of django implementations.
or, get the promotion out.
Any suggestions/ideas on this?
PS.
With these lines removed, none of the unittests fail.