Skip to content

Commit

Permalink
never compare in anything other than aware datetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe committed Mar 11, 2013
1 parent a25c9f8 commit 41d2b7d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion socorro/unittest/cron/test_crontabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from nose.plugins.attrib import attr
from socorro.cron import crontabber
from socorro.cron import base
from socorro.lib.datetimeutil import utc_now
from socorro.lib.datetimeutil import utc_now, UTC
from configman import Namespace
from .base import DSN, TestCaseBase

Expand Down Expand Up @@ -214,6 +214,7 @@ def mock_utc_now():
information['next_run'],
'%Y-%m-%d %H:%M:%S.%f'
)
next_run = next_run.replace(tzinfo=UTC)
# and then to a floating point number
next_run_ts = time.mktime(next_run.timetuple())

Expand All @@ -223,6 +224,7 @@ def mock_utc_now():
datetime.timedelta(hours=1) +
datetime.timedelta(seconds=_slowness_delay)
)
expect_next_run = expect_next_run.replace(tzinfo=UTC)
expect_next_run_ts = time.mktime(expect_next_run.timetuple())
# rounded, we expect these to be the same
self.assertEqual(round(next_run_ts), round(expect_next_run_ts))
Expand Down

0 comments on commit 41d2b7d

Please sign in to comment.