Permalink
Browse files

one more try at fixing buggy test case w.r.t timezones.

time.mktime doesn't know about timezones, but calendar.gmtime does
  • Loading branch information...
1 parent bb0e94a commit d3ec0b4aa62c931ca24c56d125fa3dab3a82b18d @crankycoder committed May 15, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 tests/transports/tests.py
@@ -7,7 +7,7 @@
from raven.transport import Transport
import datetime
-import time
+import calendar
import pytz
@@ -76,7 +76,8 @@ def test_build_then_send(self):
c = Client(dsn="mock://some_username:some_password@localhost:8143/1",
name="test_server")
- d = time.mktime(datetime.datetime(2012, 5, 4,tzinfo=pytz.utc).timetuple())
+ mydate = datetime.datetime(2012, 5, 4, tzinfo=pytz.utc)
+ d = calendar.timegm(mydate.timetuple())
msg = c.build_msg("Message", message='foo', date=d)
expected = {'project': '1',
'sentry.interfaces.Message': {'message': 'foo', 'params': ()},
@@ -87,7 +88,7 @@ def test_build_then_send(self):
'modules': {},
'site': None,
'time_spent': None,
- 'timestamp': 1336107600.0,
+ 'timestamp': 1336089600,
'message': 'foo'}
# The event_id is always overridden

0 comments on commit d3ec0b4

Please sign in to comment.