test:add special compatibility testcase for code coverage
This commit is contained in:
parent
2dcec8304a
commit
f1b606c730
|
@ -1862,38 +1862,38 @@ class TDCom:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return tbname
|
return tbname
|
||||||
|
|
||||||
def is_json(msg):
|
def is_json(msg):
|
||||||
if isinstance(msg, str):
|
if isinstance(msg, str):
|
||||||
try:
|
try:
|
||||||
json.loads(msg)
|
json.loads(msg)
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return False
|
return False
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def get_path(tool="taosd"):
|
def get_path(tool="taosd"):
|
||||||
selfPath = os.path.dirname(os.path.realpath(__file__))
|
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
if ("community" in selfPath):
|
if ("community" in selfPath):
|
||||||
projPath = selfPath[:selfPath.find("community")]
|
projPath = selfPath[:selfPath.find("community")]
|
||||||
else:
|
else:
|
||||||
projPath = selfPath[:selfPath.find("tests")]
|
projPath = selfPath[:selfPath.find("tests")]
|
||||||
|
|
||||||
paths = []
|
paths = []
|
||||||
for root, dirs, files in os.walk(projPath):
|
for root, dirs, files in os.walk(projPath):
|
||||||
if ((tool) in files or ("%s.exe"%tool) in files):
|
if ((tool) in files or ("%s.exe"%tool) in files):
|
||||||
rootRealPath = os.path.dirname(os.path.realpath(root))
|
rootRealPath = os.path.dirname(os.path.realpath(root))
|
||||||
if ("packaging" not in rootRealPath):
|
if ("packaging" not in rootRealPath):
|
||||||
paths.append(os.path.join(root, tool))
|
paths.append(os.path.join(root, tool))
|
||||||
break
|
break
|
||||||
if (len(paths) == 0):
|
if (len(paths) == 0):
|
||||||
return ""
|
|
||||||
return paths[0]
|
|
||||||
|
|
||||||
def dict2toml(in_dict: dict, file:str):
|
|
||||||
if not isinstance(in_dict, dict):
|
|
||||||
return ""
|
return ""
|
||||||
with open(file, 'w') as f:
|
return paths[0]
|
||||||
toml.dump(in_dict, f)
|
|
||||||
|
def dict2toml(in_dict: dict, file:str):
|
||||||
|
if not isinstance(in_dict, dict):
|
||||||
|
return ""
|
||||||
|
with open(file, 'w') as f:
|
||||||
|
toml.dump(in_dict, f)
|
||||||
|
|
||||||
tdCom = TDCom()
|
tdCom = TDCom()
|
||||||
|
|
Loading…
Reference in New Issue