From: Mike Bayer Date: Wed, 20 Feb 2019 17:52:40 +0000 (-0500) Subject: revise timestamp correction scheme X-Git-Tag: rel_1_3_0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3135c494e510095c938d0e7a08c4ffc0b4bb364;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git revise timestamp correction scheme For very slow CI this test still fails so establish the date as being between the range of what the operation took Change-Id: I9204cd1915777ebc58bd598065b9015befb93345 --- diff --git a/test/dialect/mysql/test_types.py b/test/dialect/mysql/test_types.py index 12f73fe246..2801c800b1 100644 --- a/test/dialect/mysql/test_types.py +++ b/test/dialect/mysql/test_types.py @@ -686,22 +686,23 @@ class TypesTest( # server-system-variables.html#sysvar_explicit_defaults_for_timestamp # changes this for 5.6 if set. - # normalize dates that are over the second boundary + # normalize dates for the amount of time the operation took def normalize(dt): if dt is None: return None - elif (dt - now).seconds < 5: + elif now <= dt <= new_now: return now else: return dt with testing.db.begin() as conn: now = conn.scalar("select now()") - conn.execute(ts_table.insert(), {"t1": now, "t2": None}) conn.execute(ts_table.insert(), {"t1": None, "t2": None}) conn.execute(ts_table.insert(), {"t2": None}) + new_now = conn.scalar("select now()") + eq_( [ tuple([normalize(dt) for dt in row])