diff --git a/httprunner/compat.py b/httprunner/compat.py index 7b11f130..966d4e89 100644 --- a/httprunner/compat.py +++ b/httprunner/compat.py @@ -268,9 +268,6 @@ def generate_conftest_for_summary(args: List): logger.error(f"No valid test path specified! \nargs: {args}") sys.exit(1) - project_meta = load_project_meta(test_path) - project_root_dir = project_meta.RootDir - conftest_path = os.path.join(project_root_dir, "conftest.py") conftest_content = '''# NOTICE: Generated By HttpRunner. import json import os @@ -337,6 +334,10 @@ def session_fixture(request): ''' + project_meta = load_project_meta(test_path) + project_root_dir = project_meta.RootDir + conftest_path = os.path.join(project_root_dir, "conftest.py") + test_path = os.path.abspath(test_path) logs_dir_path = os.path.join(project_root_dir, "logs") test_path_relative_path = test_path[len(project_root_dir) + 1 :]