make HttpRunner().run as main interface for running testcases

This commit is contained in:
debugtalk
2018-10-02 00:50:39 +08:00
parent d39ae936a3
commit a0db780977
3 changed files with 51 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
# encoding: utf-8
import os
import types
""" validate data format
TODO: refactor with JSON schema validate
"""
@@ -46,6 +48,7 @@ def is_testcase(data_structure):
return True
def is_testcases(data_structure):
""" check if data_structure is testcase or testcases list.
@@ -72,6 +75,31 @@ def is_testcases(data_structure):
return True
def is_testcase_path(path):
""" check if path is testcase path or path list.
Args:
path (str/list): file path or file path list.
Returns:
bool: True if path is valid file path or path list, otherwise False.
"""
if not isinstance(path, (str, list)):
return False
if isinstance(path, list):
for p in path:
if not is_testcase_path(p):
return False
if isinstance(path, str):
if not os.path.exists(path):
return False
return True
###############################################################################
## validate varibles and functions
###############################################################################
@@ -101,4 +129,3 @@ def is_variable(tup):
return False
return True