Skip to content

Commit

Permalink
Fix test_resize_with_aggregate on non-UTC systems (#322)
Browse files Browse the repository at this point in the history
Use datetime.utcnow() instead of .now() to calculate the UTC timestamp
without it being affected by the local timezone.  This fixes the test
failure on systems running non-UTC timezone.

Fixes #321
  • Loading branch information
mgorny authored Jul 30, 2022
1 parent 3ce395e commit 93c526f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ def test_resize_with_aggregate(self):
whisper.create(self.filename, retention)

# insert data
now_timestamp = int((datetime.now() - datetime(1970, 1, 1)).total_seconds())
now_timestamp = int((datetime.utcnow() - datetime(1970, 1, 1)).total_seconds())
now_timestamp -= now_timestamp % 60 # format timestamp
points = [(now_timestamp - i * 60, i) for i in range(0, 60 * 24 * 2)]
whisper.update_many(self.filename, points)
Expand Down

0 comments on commit 93c526f

Please sign in to comment.