From: Mike Bayer Date: Tue, 14 Mar 2023 13:16:25 +0000 (-0400) Subject: use utc for datetimetz multirange tests X-Git-Tag: rel_2_0_7~6^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8420e993764b5dcd4ce5879412d556d2a7d2870;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git use utc for datetimetz multirange tests these tests failed the day before DST here, so just use utc Fixes: #9471 Change-Id: I3f5c940b4e7d36943bd3ad34cc06b9563371d171 --- diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py index 2b15c7d735..c960b9e2f2 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -5176,24 +5176,36 @@ class _DateTimeTZMultiRangeTests: _col_type = TSTZMULTIRANGE _col_str = "TSTZMULTIRANGE" + __only_on__ = "postgresql" + # make sure we use one, steady timestamp with timezone pair # for all parts of all these tests _tstzs = None _tstzs_delta = None def tstzs(self): + utc_now = cast( + func.current_timestamp().op("AT TIME ZONE")("utc"), + DateTime(timezone=True), + ) + if self._tstzs is None: with testing.db.connect() as connection: - lower = connection.scalar(func.current_timestamp().select()) + lower = connection.scalar(select(utc_now)) upper = lower + datetime.timedelta(1) self._tstzs = (lower, upper) return self._tstzs def tstzs_delta(self): + utc_now = cast( + func.current_timestamp().op("AT TIME ZONE")("utc"), + DateTime(timezone=True), + ) + if self._tstzs_delta is None: with testing.db.connect() as connection: lower = connection.scalar( - func.current_timestamp().select() + select(utc_now) ) + datetime.timedelta(3) upper = lower + datetime.timedelta(2) self._tstzs_delta = (lower, upper)