Skip to content

Commit

Permalink
regexed ignore list in marker
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Plevka <[email protected]>
  • Loading branch information
jyejare and rplevka committed Dec 19, 2023
1 parent 83122b7 commit 39f6ea9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions betelgeuse/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Parsers for test docstrings."""
import re
from collections import namedtuple
from io import StringIO
from xml.dom import minidom
Expand Down Expand Up @@ -200,14 +201,21 @@ def parse_markers(all_markers=None, config=None):
resolved_markers = []
ignore_list = getattr(config, 'MARKERS_IGNORE_LIST', None)

def _process_marker(marker):
# Fetching exact marker name
marker_name = marker.split('mark.')[-1]
def _process_marker(_marker):

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):
re.fullmatch(
ignore_word, marker_name
) for ignore_word in ignore_list
):
return

resolved_markers.append(marker_name)

for sec_marker in all_markers:
Expand Down

0 comments on commit 39f6ea9

Please sign in to comment.