#23893 closed Bug (fixed)
naive dateime warning running tests with MySQL
Reported by: | Tim Graham | Owned by: | mhall1 |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | mhall1 | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
test_datetime_output_field (custom_lookups.tests.DateTimeLookupTests) ... /django/django/db/models/fields/__init__.py:1407: RuntimeWarning: DateTimeField (unbound) received a naive datetime (2000-01-01 00:00:00) while time zone support is active. RuntimeWarning)
Change History (11)
comment:1 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 10 years ago
Cc: | added |
---|
comment:3 by , 10 years ago
comment:4 by , 10 years ago
I can reproduce with both of those configurations using python -Wall runtests.py --settings=test_mysql custom_lookups
comment:6 by , 10 years ago
It looks like the fix for #23714 (line 1402 in django/db/models/fields/init.py) is catching an AttributeError and mistakenly raising the warning, when the error text is "'DateTimeField' object has no attribute 'model'" (rather than it being an error from pytz). I'm not so familiar with the code base yet, but I'll keep looking into it.
comment:7 by , 10 years ago
I have a patch available here: https://github.com/mhall1/django/tree/ticket_23893
Tests passing on python2.7 and python3.4 with mysql backend.
Not sure if its overkill to have a regression test testing a unit test?
comment:8 by , 10 years ago
Has patch: | set |
---|
comment:10 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Unable to reproduce on python 2.7 using MySQLdb connector or python 3.4 using mysqlclient connector. @timgraham, do you have any more information about the environment this occurred under?