mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 07:21:23 +08:00
update docstring
This commit is contained in:
@@ -140,6 +140,24 @@ def load_folder_files(folder_path, recursive=True):
|
|||||||
|
|
||||||
def load_dot_env_file(path):
|
def load_dot_env_file(path):
|
||||||
""" load .env file
|
""" load .env file
|
||||||
|
|
||||||
|
Args:
|
||||||
|
path (str): .env file path.
|
||||||
|
If path is None, it will find .env file in current working directory.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: environment variables mapping
|
||||||
|
|
||||||
|
{
|
||||||
|
"UserName": "debugtalk",
|
||||||
|
"Password": "123456",
|
||||||
|
"PROJECT_KEY": "ABCDEFGH"
|
||||||
|
}
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
exceptions.FileNotFound: If specified env file is not exist.
|
||||||
|
exceptions.FileFormatError: If env file format is invalid.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not path:
|
if not path:
|
||||||
path = os.path.join(os.getcwd(), ".env")
|
path = os.path.join(os.getcwd(), ".env")
|
||||||
@@ -719,8 +737,13 @@ def load_testcases(path):
|
|||||||
|
|
||||||
def load(path):
|
def load(path):
|
||||||
""" main interface for loading testcases
|
""" main interface for loading testcases
|
||||||
@param (str) path: testcase file/folder path
|
|
||||||
@return (list) testcases list
|
Args:
|
||||||
|
path (str): testcase file/folder path
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
list: testcases list
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if validator.is_testcases(path):
|
if validator.is_testcases(path):
|
||||||
return path
|
return path
|
||||||
|
|||||||
@@ -206,7 +206,8 @@ class HttpRunner(object):
|
|||||||
- dot_env_path: .env file path
|
- dot_env_path: .env file path
|
||||||
"""
|
"""
|
||||||
dot_env_path = kwargs.pop("dot_env_path", None)
|
dot_env_path = kwargs.pop("dot_env_path", None)
|
||||||
utils.set_os_environ(loader.load_dot_env_file(dot_env_path))
|
self.env_mapping = loader.load_dot_env_file(dot_env_path)
|
||||||
|
utils.set_os_environ(self.env_mapping)
|
||||||
|
|
||||||
kwargs.setdefault("resultclass", HtmlTestResult)
|
kwargs.setdefault("resultclass", HtmlTestResult)
|
||||||
self.runner = unittest.TextTestRunner(**kwargs)
|
self.runner = unittest.TextTestRunner(**kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user