Skip to content

Commit

Permalink
pytester: add __tracebackhide__ for matching randomly (#6746)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored Feb 16, 2020
1 parent 7b8968f commit bc976dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/_pytest/pytester.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,16 +1334,19 @@ def _getlines(self, lines2: Union[str, Sequence[str], Source]) -> Sequence[str]:
def fnmatch_lines_random(self, lines2: Sequence[str]) -> None:
"""Check lines exist in the output in any order (using :func:`python:fnmatch.fnmatch`).
"""
__tracebackhide__ = True
self._match_lines_random(lines2, fnmatch)

def re_match_lines_random(self, lines2: Sequence[str]) -> None:
"""Check lines exist in the output in any order (using :func:`python:re.match`).
"""
__tracebackhide__ = True
self._match_lines_random(lines2, lambda name, pat: bool(re.match(pat, name)))

def _match_lines_random(
self, lines2: Sequence[str], match_func: Callable[[str, str], bool]
) -> None:
__tracebackhide__ = True
lines2 = self._getlines(lines2)
for line in lines2:
for x in self.lines:
Expand Down

0 comments on commit bc976dc

Please sign in to comment.