mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +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):
|
||||
""" 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:
|
||||
path = os.path.join(os.getcwd(), ".env")
|
||||
@@ -719,8 +737,13 @@ def load_testcases(path):
|
||||
|
||||
def load(path):
|
||||
""" 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):
|
||||
return path
|
||||
|
||||
@@ -206,7 +206,8 @@ class HttpRunner(object):
|
||||
- dot_env_path: .env file path
|
||||
"""
|
||||
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)
|
||||
self.runner = unittest.TextTestRunner(**kwargs)
|
||||
|
||||
Reference in New Issue
Block a user