MCPcopy
hub / github.com/pytest-dev/pytest / _no_match_line

Method _no_match_line

src/_pytest/pytester.py:1764–1793  ·  view source on GitHub ↗

Underlying implementation of ``no_fnmatch_line`` and ``no_re_match_line``. :param str pat: The pattern to match lines. :param match_func: A callable ``match_func(line, pattern)`` where line is the captured line from stdout/stderr and pattern is th

(
        self, pat: str, match_func: Callable[[str, str], bool], match_nickname: str
    )

Source from the content-addressed store, hash-verified

1762 )
1763
1764 def _no_match_line(
1765 self, pat: str, match_func: Callable[[str, str], bool], match_nickname: str
1766 ) -> None:
1767 """Underlying implementation of ``no_fnmatch_line`` and ``no_re_match_line``.
1768
1769 :param str pat:
1770 The pattern to match lines.
1771 :param match_func:
1772 A callable ``match_func(line, pattern)`` where line is the
1773 captured line from stdout/stderr and pattern is the matching
1774 pattern.
1775 :param match_nickname:
1776 The nickname for the match function that will be logged to stdout
1777 when a match occurs.
1778 """
1779 __tracebackhide__ = True
1780 nomatch_printed = False
1781 wnick = len(match_nickname) + 1
1782 for line in self.lines:
1783 if match_func(line, pat):
1784 msg = f"{match_nickname}: {pat!r}"
1785 self._log(msg)
1786 self._log("{:>{width}}".format("with:", width=wnick), repr(line))
1787 self._fail(msg)
1788 else:
1789 if not nomatch_printed:
1790 self._log("{:>{width}}".format("nomatch:", width=wnick), repr(pat))
1791 nomatch_printed = True
1792 self._log("{:>{width}}".format("and:", width=wnick), repr(line))
1793 self._log_output = []
1794
1795 def _fail(self, msg: str) -> None:
1796 __tracebackhide__ = True

Callers 2

no_fnmatch_lineMethod · 0.95
no_re_match_lineMethod · 0.95

Calls 3

_logMethod · 0.95
_failMethod · 0.95
formatMethod · 0.45

Tested by

no test coverage detected