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)
|
||||
return tbname
|
||||
|
||||
def is_json(msg):
|
||||
if isinstance(msg, str):
|
||||
try:
|
||||
json.loads(msg)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
def is_json(msg):
|
||||
if isinstance(msg, str):
|
||||
try:
|
||||
json.loads(msg)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_path(tool="taosd"):
|
||||
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||
if ("community" in selfPath):
|
||||
projPath = selfPath[:selfPath.find("community")]
|
||||
else:
|
||||
projPath = selfPath[:selfPath.find("tests")]
|
||||
def get_path(tool="taosd"):
|
||||
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||
if ("community" in selfPath):
|
||||
projPath = selfPath[:selfPath.find("community")]
|
||||
else:
|
||||
projPath = selfPath[:selfPath.find("tests")]
|
||||
|
||||
paths = []
|
||||
for root, dirs, files in os.walk(projPath):
|
||||
if ((tool) in files or ("%s.exe"%tool) in files):
|
||||
rootRealPath = os.path.dirname(os.path.realpath(root))
|
||||
if ("packaging" not in rootRealPath):
|
||||
paths.append(os.path.join(root, tool))
|
||||
break
|
||||
if (len(paths) == 0):
|
||||
return ""
|
||||
return paths[0]
|
||||
|
||||
def dict2toml(in_dict: dict, file:str):
|
||||
if not isinstance(in_dict, dict):
|
||||
paths = []
|
||||
for root, dirs, files in os.walk(projPath):
|
||||
if ((tool) in files or ("%s.exe"%tool) in files):
|
||||
rootRealPath = os.path.dirname(os.path.realpath(root))
|
||||
if ("packaging" not in rootRealPath):
|
||||
paths.append(os.path.join(root, tool))
|
||||
break
|
||||
if (len(paths) == 0):
|
||||
return ""
|
||||
with open(file, 'w') as f:
|
||||
toml.dump(in_dict, f)
|
||||
return paths[0]
|
||||
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue