'Search the text for matching lines.
The argument is a list of lines which have to match and can
use glob wildcards.  If they do not match an pytest.fail() is
called.  The matches and non-matches are also printed on
stdout.'

def fnmatch_lines(self, lines2):

    lines2 = self._getlines(lines2)
    lines1 = self.lines[:]
    nextline = None
    extralines = []
    __tracebackhide__ = True
    for line in lines2:
        nomatchprinted = False
        while lines1:
            nextline = lines1.pop(0)
            if (line == nextline):
                self._log('exact    match:', repr(line))
                break
            elif fnmatch(nextline, line):
                self._log('fnmatch:', repr(line))
                self._log('            with:', repr(nextline))
                break
            else:
                if (not nomatchprinted):
                    self._log('nomatch:', repr(line))
                    nomatchprinted = True
                self._log('                and:', repr(nextline))
            extralines.append(nextline)
        else:
            self._log(('remains    unmatched:    %r' % (line,)))
            pytest.fail(self._log_text)
