1. Weston Nielson
  2. django-chronograph
  3. Issues
Issue #23 new

django 1.4 timezone breaks tests

Matt Warren
created an issue

with USE_TZ=True I get these test breakages:

====================================================================== ERROR: testCronCleanCommand (chronograph.tests.JobTestCase)


Traceback (most recent call last): File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/tests/init.py", line 67, in testCronCleanCommand job.run() File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/models.py", line 297, in run call_command('run_job', str(self.pk)) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/core/management/init.py", line 150, in call_command return klass.execute(*args, defaults) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, options) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/management/commands/run_job.py", line 26, in handle job.handle_run() File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/models.py", line 365, in handle_run self.next_run = dates.make_aware(self.rrule.after(self.next_run)) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/compatibility/dates.py", line 44, in make_aware dt = get_tz_date(dt, timezone.make_aware, tz) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/compatibility/dates.py", line 30, in get_tz_date dt = meth(dt, timezone.utc) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/utils/timezone.py", line 269, in make_aware return timezone.localize(value, is_dst=None) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/pytz/init.py", line 235, in localize raise ValueError('Not naive datetime (tzinfo is already set)') ValueError: Not naive datetime (tzinfo is already set)

====================================================================== ERROR: testJobRun (chronograph.tests.JobTestCase)


Traceback (most recent call last): File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/tests/init.py", line 33, in testJobRun job.run() File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/models.py", line 297, in run call_command('run_job', str(self.pk)) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/core/management/init.py", line 150, in call_command return klass.execute(*args, defaults) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, options) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/management/commands/run_job.py", line 26, in handle job.handle_run() File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/models.py", line 365, in handle_run self.next_run = dates.make_aware(self.rrule.after(self.next_run)) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/compatibility/dates.py", line 44, in make_aware dt = get_tz_date(dt, timezone.make_aware, tz) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/compatibility/dates.py", line 30, in get_tz_date dt = meth(dt, timezone.utc) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/utils/timezone.py", line 269, in make_aware return timezone.localize(value, is_dst=None) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/pytz/init.py", line 235, in localize raise ValueError('Not naive datetime (tzinfo is already set)') ValueError: Not naive datetime (tzinfo is already set)


with USE_TZ=False it gives a different error:

====================================================================== ERROR: testCronCleanCommand (chronograph.tests.JobTestCase)


Traceback (most recent call last): File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/tests/init.py", line 67, in testCronCleanCommand job.run() File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/models.py", line 297, in run call_command('run_job', str(self.pk)) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/core/management/init.py", line 150, in call_command return klass.execute(*args, defaults) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, options) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/management/commands/run_job.py", line 26, in handle job.handle_run() File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/models.py", line 365, in handle_run self.next_run = dates.make_aware(self.rrule.after(self.next_run)) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/dateutil/rrule.py", line 199, in after if i > dt: TypeError: can't compare offset-naive and offset-aware datetimes

====================================================================== ERROR: testJobRun (chronograph.tests.JobTestCase)


Traceback (most recent call last): File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/tests/init.py", line 33, in testJobRun job.run() File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/models.py", line 297, in run call_command('run_job', str(self.pk)) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/core/management/init.py", line 150, in call_command return klass.execute(*args, defaults) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, options) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/management/commands/run_job.py", line 26, in handle job.handle_run() File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/chronograph/models.py", line 365, in handle_run self.next_run = dates.make_aware(self.rrule.after(self.next_run)) File "/home/mwarren/.virtualenvs/vogogo2/local/lib/python2.7/site-packages/dateutil/rrule.py", line 199, in after if i > dt: TypeError: can't compare offset-naive and offset-aware datetimes


Comments (2)

  1. Log in to comment