提交 98979cf7 编写于 作者: J jiacy-jcy

update timezone.py

上级 a3d7e07f
...@@ -3,11 +3,13 @@ from time import sleep ...@@ -3,11 +3,13 @@ from time import sleep
from tkinter import E from tkinter import E
import taos import taos
import sys import sys
import time
from tzlocal import get_localzone
from util.log import * from util.log import *
from util.sql import * from util.sql import *
from util.cases import * from util.cases import *
import os
class TDTestCase: class TDTestCase:
...@@ -17,9 +19,10 @@ class TDTestCase: ...@@ -17,9 +19,10 @@ class TDTestCase:
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
def run(self): # sourcery skip: extract-duplicate-method def run(self): # sourcery skip: extract-duplicate-method
# for func now() , today(), timezone()
tdSql.prepare() tdSql.prepare()
# get system timezone
time_zone = os.popen('timedatectl | grep zone').read().strip().split(':')[1].lstrip()
tdLog.printNoPrefix("==========step1:create tables==========") tdLog.printNoPrefix("==========step1:create tables==========")
tdSql.execute( tdSql.execute(
'''create table if not exists ntb '''create table if not exists ntb
...@@ -41,24 +44,30 @@ class TDTestCase: ...@@ -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)") tdSql.execute("insert into stb_1 values(now,111,99.99,11.111111)(today(),1,11.111,22.222222)")
tdLog.printNoPrefix("==========step3:query data==========") tdLog.printNoPrefix("==========step3:query data==========")
tdSql.query("select timezone() from ntb") for i in range(0,10):
tdSql.checkRows(2) tdSql.query("select timezone() from ntb")
tdSql.query("select timezone() from db.ntb") tdSql.checkRows(2)
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.query("select timezone() from stb")
tdSql.checkRows(2) tdSql.checkRows(2)
tdSql.checkData(0,0,time_zone)
tdSql.query("select timezone() from db.stb") tdSql.query("select timezone() from db.stb")
tdSql.checkRows(2) tdSql.checkRows(2)
tdSql.checkData(0,0,time_zone)
tdSql.query("select timezone() from stb_1") tdSql.query("select timezone() from stb_1")
tdSql.checkRows(2) tdSql.checkRows(2)
tdSql.checkData(0,0,time_zone)
tdSql.query("select timezone() from db.stb_1 ") tdSql.query("select timezone() from db.stb_1 ")
tdSql.checkRows(2) tdSql.checkRows(2)
tdSql.checkData(0,0,time_zone)
# tdSql.execute()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册