X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=tests%2Fdbtest_timestamps.py;h=1a53ae8665da5c9241370165bc5136c5926533a8;hb=8ff7594617f38652f8dbac95682dcfc200d6dbf5;hp=ff19d7d0ad18dd7d47be6d8887e25a5aa2c40d9e;hpb=695b2d37022b899f3305dc83d89aa6dfee8af55e;p=dak.git diff --git a/tests/dbtest_timestamps.py b/tests/dbtest_timestamps.py index ff19d7d0..1a53ae86 100755 --- a/tests/dbtest_timestamps.py +++ b/tests/dbtest_timestamps.py @@ -4,6 +4,7 @@ from db_test import DBDakTestCase from daklib.dbconn import DBConn, Uid +from sqlalchemy import func import time import unittest @@ -16,10 +17,13 @@ class TimestampTestCase(DBDakTestCase): """ def now(self): + "returns the current time at the db server" + + # we fetch a fresh session each time to avoid caching local_session = DBConn().session() - query = local_session.query('now').from_statement('select now() as now') + current_time = local_session.query(func.now()).scalar() local_session.close() - return query.one().now + return current_time def sleep(self): time.sleep(0.001)