mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-16 10:47:35 +08:00
upgrade to 0.9.7: support .env file
This commit is contained in:
@@ -7,7 +7,8 @@ import unittest
|
||||
from httprunner import logger
|
||||
from httprunner.__about__ import __version__
|
||||
from httprunner.task import HttpRunner
|
||||
from httprunner.utils import create_scaffold, print_output, string_type
|
||||
from httprunner.utils import (create_scaffold, load_dot_env_file, print_output,
|
||||
string_type)
|
||||
|
||||
|
||||
def main_hrun():
|
||||
@@ -30,6 +31,9 @@ def main_hrun():
|
||||
parser.add_argument(
|
||||
'--log-level', default='INFO',
|
||||
help="Specify logging level, default is INFO.")
|
||||
parser.add_argument(
|
||||
'--dot-env-path',
|
||||
help="Specify .env file path, which is useful for keeping production credentials.")
|
||||
parser.add_argument(
|
||||
'--failfast', action='store_true', default=False,
|
||||
help="Stop the test run on the first error or failure.")
|
||||
@@ -44,6 +48,10 @@ def main_hrun():
|
||||
logger.color_print("{}".format(__version__), "GREEN")
|
||||
exit(0)
|
||||
|
||||
dot_env_path = args.dot_env_path or os.path.join(os.getcwd(), ".env")
|
||||
if dot_env_path:
|
||||
load_dot_env_file(dot_env_path)
|
||||
|
||||
project_name = args.startproject
|
||||
if project_name:
|
||||
project_path = os.path.join(os.getcwd(), project_name)
|
||||
|
||||
Reference in New Issue
Block a user