提交 d95cba5b 编写于 作者: T Torsten Werner

TimestampTestCase: replace sql string by func.now.

Signed-off-by: NTorsten Werner <twerner@debian.org>
上级 48fc8094
......@@ -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.first().now
return current_time
def sleep(self):
time.sleep(0.001)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册