pytester: add __tracebackhide__ for matching randomly (#6746)

This commit is contained in:
Daniel Hahler 2020-02-16 10:29:59 +01:00 committed by GitHub
parent 7b8968ff80
commit bc976dca3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1334,16 +1334,19 @@ class LineMatcher:
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: