From c9dbd8c35630dcceb84aa3d66b640861b8deaea4 Mon Sep 17 00:00:00 2001 From: Jitendra Yejare Date: Tue, 19 Dec 2023 17:06:14 +0530 Subject: [PATCH] regexed marker name in ignore list Co-authored-by: Roman Plevka --- betelgeuse/parser.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/betelgeuse/parser.py b/betelgeuse/parser.py index 03e1058..3ca27d4 100644 --- a/betelgeuse/parser.py +++ b/betelgeuse/parser.py @@ -1,4 +1,5 @@ """Parsers for test docstrings.""" +import re from collections import namedtuple from io import StringIO from xml.dom import minidom @@ -202,11 +203,13 @@ def parse_markers(all_markers=None, config=None): def _process_marker(marker): # Fetching exact marker name - marker_name = marker.split('mark.')[-1] + marker_name = re.findall( + r'(?:pytest\.mark\.)?([^(\s()]+)(?=\s*\(|\s*$)', marker) + if marker_name: + marker_name = marker_name[0] # ignoring the marker if in ignore list - if ignore_list and any( - ignore_word in marker_name for ignore_word in ignore_list): + if ignore_list and marker_name in ignore_list: return resolved_markers.append(marker_name)