Skip to content

Commit

Permalink
special case text_type matches Fixes #5478
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Jun 24, 2019
1 parent 4b104ba commit 5dbbabd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/_pytest/_code/code.py
Expand Up @@ -572,6 +572,11 @@ def match(self, regexp):
raised.
"""
__tracebackhide__ = True
if isinstance(regexp, text_type):
if not re.search(regexp, text_type(self.value)):
assert 0, u"Pattern '{!s}' not found in '{!s}'".format(regexp, self.value)
return True

if not re.search(regexp, str(self.value)):
assert 0, "Pattern '{!s}' not found in '{!s}'".format(regexp, self.value)
return True
Expand Down

0 comments on commit 5dbbabd

Please sign in to comment.