注册自定义标记时,增加去重处理
This commit is contained in:
+8
-4
@@ -23,15 +23,19 @@ def pytest_configure(config):
|
||||
注册自定义标记
|
||||
"""
|
||||
# 注册自定义标记
|
||||
logger.trace(f"需要注册的标记:{CUSTOM_MARKERS}")
|
||||
for custom_marker in CUSTOM_MARKERS:
|
||||
logger.debug(f"需要注册的标记:{CUSTOM_MARKERS}")
|
||||
# 对标记进行去重处理
|
||||
unique_markers = []
|
||||
for item in CUSTOM_MARKERS:
|
||||
if item not in unique_markers:
|
||||
unique_markers.append(item)
|
||||
# 注册标记
|
||||
for custom_marker in unique_markers:
|
||||
if isinstance(custom_marker, str):
|
||||
config.addinivalue_line('markers', f'{custom_marker}')
|
||||
logger.debug(f"注册了自定义标记:{custom_marker}")
|
||||
elif isinstance(custom_marker, dict):
|
||||
for k, v in custom_marker.items():
|
||||
config.addinivalue_line('markers', f'{k}:{v}')
|
||||
logger.debug(f"注册了自定义标记:{custom_marker}")
|
||||
|
||||
|
||||
def pytest_terminal_summary(terminalreporter, config):
|
||||
|
||||
Reference in New Issue
Block a user