new joyhub_backend
This commit is contained in:
33
joyhub_backend/test_case/TestCase/接口/conftest.py
Normal file
33
joyhub_backend/test_case/TestCase/接口/conftest.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import sys
|
||||
|
||||
current_file_path = os.path.abspath(__file__)
|
||||
project_root = os.path.abspath(os.path.join(os.path.dirname(current_file_path), '../../../..'))
|
||||
if project_root not in sys.path:
|
||||
sys.path.insert(0, project_root)
|
||||
|
||||
try:
|
||||
import allure_pytest.listener
|
||||
except ImportError:
|
||||
allure_pytest = None
|
||||
|
||||
|
||||
def _allure_test_fixtures_compatible(item):
|
||||
fixturemanager = item.session._fixturemanager
|
||||
fixturedefs = []
|
||||
|
||||
if hasattr(item, "_request") and hasattr(item._request, "fixturenames"):
|
||||
for name in item._request.fixturenames:
|
||||
try:
|
||||
fixturedefs_pytest = fixturemanager.getfixturedefs(name, item)
|
||||
except AttributeError:
|
||||
fixturedefs_pytest = fixturemanager.getfixturedefs(name, item.nodeid)
|
||||
if fixturedefs_pytest:
|
||||
fixturedefs.extend(fixturedefs_pytest)
|
||||
|
||||
return fixturedefs
|
||||
|
||||
|
||||
if allure_pytest is not None:
|
||||
allure_pytest.listener._test_fixtures = _allure_test_fixtures_compatible
|
||||
Reference in New Issue
Block a user