diff --git a/httprunner/compat.py b/httprunner/compat.py index d4dd78d8..e683eaf5 100644 --- a/httprunner/compat.py +++ b/httprunner/compat.py @@ -220,11 +220,8 @@ def generate_conftest_for_summary(args: List): sys.exit(1) project_meta = load_project_meta(test_path) - conftest_path = os.path.join(project_meta.RootDir, "conftest.py") - conftest_path = ensure_file_path_valid(conftest_path) - if os.path.isfile(conftest_path): - return - + project_root_dir = ensure_file_path_valid(project_meta.RootDir) + conftest_path = os.path.join(project_root_dir, "conftest.py") conftest_content = '''# NOTICE: Generated By HttpRunner. import json import os @@ -292,8 +289,8 @@ def session_fixture(request): ''' test_path = os.path.abspath(test_path) - logs_dir_path = os.path.join(project_meta.RootDir, "logs") - test_path_relative_path = test_path[len(project_meta.RootDir) + 1 :] + logs_dir_path = os.path.join(project_root_dir, "logs") + test_path_relative_path = test_path[len(project_root_dir) + 1 :] if os.path.isdir(test_path): file_foder_path = os.path.join(logs_dir_path, test_path_relative_path)