From c25b7a1143a2285ba82c18ffef7dec5c0f8c480b Mon Sep 17 00:00:00 2001 From: kadero Date: Wed, 29 Sep 2021 22:57:11 +0200 Subject: [PATCH] Fix integration tests (#3953) * Fix integration tests * Update changelog.md * Update changelog.md * Bump up contributor note to 1.0.0 Co-authored-by: Jeremy Cohen --- CHANGELOG.md | 2 +- .../004_simple_snapshot_test/test_simple_snapshot.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1bda0e2599..ab92697c4cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ Contributors: - [@dave-connors-3](https://github.com/dave-connors-3) ([#3920](https://github.com/dbt-labs/dbt/issues/3920)) - +- [@kadero](https://github.com/kadero) ([#3952](https://github.com/dbt-labs/dbt/issues/3952)) ## dbt 0.21.0 (Release TBD) diff --git a/test/integration/004_simple_snapshot_test/test_simple_snapshot.py b/test/integration/004_simple_snapshot_test/test_simple_snapshot.py index 7bcb1437eb9..e2e4f30a3c4 100644 --- a/test/integration/004_simple_snapshot_test/test_simple_snapshot.py +++ b/test/integration/004_simple_snapshot_test/test_simple_snapshot.py @@ -906,7 +906,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 @@ -946,7 +946,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( @@ -968,5 +968,5 @@ 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])