From 98979cf7ced7bac9a89278a4cbfe1c279a88948d Mon Sep 17 00:00:00 2001 From: jiacy-jcy <714897623@qq.com> Date: Fri, 22 Apr 2022 15:59:09 +0800 Subject: [PATCH] update timezone.py --- tests/system-test/2-query/timezone.py | 33 +++++++++++++++++---------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/tests/system-test/2-query/timezone.py b/tests/system-test/2-query/timezone.py index 8c24996336..45544cb996 100644 --- a/tests/system-test/2-query/timezone.py +++ b/tests/system-test/2-query/timezone.py @@ -3,11 +3,13 @@ from time import sleep from tkinter import E import taos import sys - +import time +from tzlocal import get_localzone from util.log import * from util.sql import * from util.cases import * +import os class TDTestCase: @@ -17,9 +19,10 @@ class TDTestCase: tdSql.init(conn.cursor()) def run(self): # sourcery skip: extract-duplicate-method - # for func now() , today(), timezone() tdSql.prepare() - + # get system timezone + time_zone = os.popen('timedatectl | grep zone').read().strip().split(':')[1].lstrip() + tdLog.printNoPrefix("==========step1:create tables==========") tdSql.execute( '''create table if not exists ntb @@ -41,24 +44,30 @@ class TDTestCase: tdSql.execute("insert into stb_1 values(now,111,99.99,11.111111)(today(),1,11.111,22.222222)") tdLog.printNoPrefix("==========step3:query data==========") - tdSql.query("select timezone() from ntb") - tdSql.checkRows(2) - tdSql.query("select timezone() from db.ntb") - tdSql.checkRows(2) - + for i in range(0,10): + tdSql.query("select timezone() from ntb") + tdSql.checkRows(2) + tdSql.checkData(0,0,time_zone) + i+=1 + + for i in range(0,10): + tdSql.query("select timezone() from db.ntb") + tdSql.checkRows(2) + tdSql.checkData(0,0,time_zone) + i+=1 tdSql.query("select timezone() from stb") tdSql.checkRows(2) + tdSql.checkData(0,0,time_zone) tdSql.query("select timezone() from db.stb") tdSql.checkRows(2) + tdSql.checkData(0,0,time_zone) tdSql.query("select timezone() from stb_1") tdSql.checkRows(2) + tdSql.checkData(0,0,time_zone) tdSql.query("select timezone() from db.stb_1 ") tdSql.checkRows(2) - - # tdSql.execute() - - + tdSql.checkData(0,0,time_zone) -- GitLab