mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-14 04:09:38 +08:00
make HttpRunner().run as main interface for running testcases
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user