Skip to content

Commit

Permalink
Switch datetime tz logic dbt-labs/dbt-core#3953
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Oct 2, 2021
1 parent c2f7131 commit 9686843
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def _snapshot_and_assert_invalidated(self):
for result in snapshotted[10:]:
# result is a tuple, the dbt_valid_to column is the latest
self.assertIsInstance(result[-1], datetime)
self.assertGreaterEqual(result[-1].astimezone(pytz.UTC), self._invalidated_snapshot_datetime)
self.assertGreaterEqual(result[-1].replace(tzinfo=pytz.UTC), self._invalidated_snapshot_datetime)

def _revive_records(self):
database = self.default_database
Expand Down Expand Up @@ -365,7 +365,7 @@ def _snapshot_and_assert_revived(self):
for result in invalidated_records:
# result is a tuple, the dbt_valid_to column is the latest
self.assertIsInstance(result[1], datetime)
self.assertGreaterEqual(result[1].astimezone(pytz.UTC), self._invalidated_snapshot_datetime)
self.assertGreaterEqual(result[1].replace(tzinfo=pytz.UTC), self._invalidated_snapshot_datetime)

# records which weren't revived (id != 10, 11)
revived_records = self.run_sql(
Expand All @@ -387,7 +387,7 @@ def _snapshot_and_assert_revived(self):
self.assertIsInstance(result[1], datetime)
# there are milliseconds (part of microseconds in datetime objects) in the
# invalidated_snapshot_datetime and not in result datetime so set the microseconds to 0
self.assertGreaterEqual(result[1].astimezone(pytz.UTC), self._invalidated_snapshot_datetime.replace(microsecond=0))
self.assertGreaterEqual(result[1].replace(tzinfo=pytz.UTC), self._invalidated_snapshot_datetime.replace(microsecond=0))
self.assertIsNone(result[2])

@use_profile('redshift')
Expand Down

0 comments on commit 9686843

Please sign in to comment.