Skip to content

Commit ed6d408

Browse files
committed
test: less flaky test
Sometimes the test would cross a second boundary, and break
1 parent b4b7b9d commit ed6d408

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ def test_time_and_non_python_identifier(self):
376376
), get_libsqlite3=get_libsqlite3) as query:
377377
now = datetime.datetime.utcnow()
378378
with query("SELECT date('now'), time('now')") as (columns, rows):
379-
rows = list(rows)
379+
rows = list((datetime.datetime.strptime(row[0] + ' ' + row[1], '%Y-%m-%d %H:%M:%S'),) for row in rows)
380380

381-
self.assertEqual(rows, [(now.strftime('%Y-%m-%d'), now.strftime('%H:%M:%S'))])
381+
self.assertTrue(all((row[0] - now) < datetime.timedelta(seconds=3) for row in rows))
382382
self.assertEqual(columns, ("date('now')", "time('now')"))
383383

384384
def test_non_existant_table(self):

0 commit comments

Comments
 (0)