mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 23:41:22 +08:00
Merge pull request #369 from HttpRunner/bugfix
fix #368: failed to load .env data in debugtalk.py
This commit is contained in:
@@ -892,19 +892,23 @@ def load_project_tests(test_path):
|
|||||||
load_builtin_module()
|
load_builtin_module()
|
||||||
|
|
||||||
debugtalk_path = locate_debugtalk_py(test_path)
|
debugtalk_path = locate_debugtalk_py(test_path)
|
||||||
|
# locate PWD with debugtalk.py path
|
||||||
if debugtalk_path:
|
if debugtalk_path:
|
||||||
# The folder contains debugtalk.py will be treated as PWD.
|
# The folder contains debugtalk.py will be treated as PWD.
|
||||||
# add PWD to sys.path
|
# add PWD to sys.path
|
||||||
project_working_directory = os.path.dirname(debugtalk_path)
|
project_working_directory = os.path.dirname(debugtalk_path)
|
||||||
|
|
||||||
# load debugtalk.py
|
|
||||||
sys.path.insert(0, project_working_directory)
|
|
||||||
load_debugtalk_module()
|
|
||||||
else:
|
else:
|
||||||
# debugtalk.py not found, use os.getcwd() as PWD.
|
# debugtalk.py not found, use os.getcwd() as PWD.
|
||||||
project_working_directory = os.getcwd()
|
project_working_directory = os.getcwd()
|
||||||
|
|
||||||
|
# load .env
|
||||||
load_dot_env_file()
|
load_dot_env_file()
|
||||||
|
|
||||||
|
# load debugtalk.py
|
||||||
|
if debugtalk_path:
|
||||||
|
sys.path.insert(0, project_working_directory)
|
||||||
|
load_debugtalk_module()
|
||||||
|
|
||||||
load_api_folder(os.path.join(project_working_directory, "api"))
|
load_api_folder(os.path.join(project_working_directory, "api"))
|
||||||
# TODO: replace suite with testcases
|
# TODO: replace suite with testcases
|
||||||
load_test_folder(os.path.join(project_working_directory, "suite"))
|
load_test_folder(os.path.join(project_working_directory, "suite"))
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import time
|
|||||||
from tests.api_server import HTTPBIN_SERVER, SECRET_KEY, gen_md5, get_sign
|
from tests.api_server import HTTPBIN_SERVER, SECRET_KEY, gen_md5, get_sign
|
||||||
|
|
||||||
BASE_URL = "http://127.0.0.1:5000"
|
BASE_URL = "http://127.0.0.1:5000"
|
||||||
|
UserName = os.environ['UserName']
|
||||||
|
|
||||||
|
|
||||||
demo_default_request = {
|
demo_default_request = {
|
||||||
"base_url": "$BASE_URL",
|
"base_url": "$BASE_URL",
|
||||||
|
|||||||
Reference in New Issue
Block a user