]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
revise timestamp correction scheme
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 20 Feb 2019 17:52:40 +0000 (12:52 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 20 Feb 2019 17:52:40 +0000 (12:52 -0500)
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

test/dialect/mysql/test_types.py

index 12f73fe2463c4d1406ae7ceddd648136d4042048..2801c800b1bf5bea46368acb8078f1158105fd3f 100644 (file)
@@ -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])