Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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 mhall1, 10 years ago

Owner: changed from nobody to mhall1
Status: newassigned

comment:2 by mhall1, 10 years ago

Cc: mhall1 added

comment:3 by mhall1, 10 years ago

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?

comment:4 by Tim Graham, 10 years ago

I can reproduce with both of those configurations using python -Wall runtests.py --settings=test_mysql custom_lookups

comment:5 by mhall1, 10 years ago

Thanks. I can reproduce it now. I was missing the -Wall flag.

comment:6 by mhall1, 10 years ago

<snipped> Turns out I was way off base

Last edited 10 years ago by mhall1 (previous) (diff)

comment:7 by mhall1, 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 mhall1, 10 years ago

Has patch: set

comment:9 by Berker Peksag, 10 years ago

Triage Stage: AcceptedReady for checkin

PR #3737 LGTM.

comment:10 by Michael Hall <mhall1@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 4fada6f1c9930e589aebe8bdfb5795f69d253c07:

Fixed #23893: Added tzinfo to constant datetime in unit test

Added tzinfo to y2k constant (01/01/2000) in
custom_lookups.tests.DateTimeLookupTests.test_datetime_output_field
to fix warning message regarding naive datetimes.

comment:11 by Aymeric Augustin <aymeric.augustin@…>, 10 years ago

In 2cb9d984cf7a0965ca6b1322ab836d56278f8749:

Merge pull request #3737 from mhall1/ticket_23893

Fixed #23893: Added tzinfo to constant datetime in unit test

Note: See TracTickets for help on using tickets.
Back to Top