mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-10 23:12:41 +08:00
replace docstring to Google style for module loader functions
This commit is contained in:
@@ -171,16 +171,30 @@ def load_dot_env_file(path):
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
def locate_debugtalk_py(start_dir_path):
|
def locate_debugtalk_py(start_dir_path):
|
||||||
""" locate debugtalk.py module and return module name
|
""" locate debugtalk.py module and return module name.
|
||||||
e.g.
|
|
||||||
debugtalk.py => "debugtalk"
|
Args:
|
||||||
tests/debugtalk.py => "tests.debugtalk"
|
start_dir_path (str): start locating directory path
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: located module name. None if module not found.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# CWD/debugtalk.py
|
||||||
|
>>> locate_debugtalk_py("/path/to/CWD")
|
||||||
|
debugtalk
|
||||||
|
|
||||||
|
# CWD/tests/debugtalk.py
|
||||||
|
>>> locate_debugtalk_py("/path/to/CWD")
|
||||||
|
tests.debugtalk
|
||||||
|
|
||||||
"""
|
"""
|
||||||
module_path = os.path.join(start_dir_path, "debugtalk.py")
|
module_path = os.path.join(start_dir_path, "debugtalk.py")
|
||||||
if os.path.isfile(module_path):
|
if os.path.isfile(module_path):
|
||||||
return "debugtalk"
|
return "debugtalk"
|
||||||
|
|
||||||
# make compatible with former version
|
# make compatible with former version
|
||||||
|
# TODO: remove this compatiblity
|
||||||
module_path = os.path.join(start_dir_path, "tests", "debugtalk.py")
|
module_path = os.path.join(start_dir_path, "tests", "debugtalk.py")
|
||||||
if os.path.isfile(module_path):
|
if os.path.isfile(module_path):
|
||||||
return "tests.debugtalk"
|
return "tests.debugtalk"
|
||||||
@@ -189,10 +203,31 @@ def locate_debugtalk_py(start_dir_path):
|
|||||||
|
|
||||||
|
|
||||||
def load_debugtalk_module(module_name=None):
|
def load_debugtalk_module(module_name=None):
|
||||||
""" load debugtalk.py module
|
""" load debugtalk.py module.
|
||||||
@param (str) module_name
|
|
||||||
e.g. debugtalk
|
Args:
|
||||||
tests.debugtalk
|
module_name (str, optional): module name for debugtalk.py. Defaults to None.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: variables and functions mapping for debugtalk.py
|
||||||
|
|
||||||
|
{
|
||||||
|
"variables": {},
|
||||||
|
"functions": {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# debugtalk.py
|
||||||
|
>>> load_debugtalk_module()
|
||||||
|
debugtalk
|
||||||
|
|
||||||
|
# tests/debugtalk.py
|
||||||
|
>>> load_debugtalk_module()
|
||||||
|
tests.debugtalk
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
exceptions.ParamsError: If failed to import specified module.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
module_name = module_name or locate_debugtalk_py(os.getcwd())
|
module_name = module_name or locate_debugtalk_py(os.getcwd())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user