use getrawcode from _pytest._code

This commit is contained in:
Anthony Sottile 2022-10-19 10:56:43 -04:00
parent 349f4bffa0
commit 965e942dfb
1 changed files with 3 additions and 1 deletions

View File

@ -109,6 +109,8 @@ class Checkers:
return str(self.path).endswith(arg)
def _evaluate(self, kw):
from .._code.source import getrawcode
for name, value in kw.items():
invert = False
meth = None
@ -124,7 +126,7 @@ class Checkers:
if meth is None:
raise TypeError(f"no {name!r} checker available for {self.path!r}")
try:
if py.code.getrawcode(meth).co_argcount > 1:
if getrawcode(meth).co_argcount > 1:
if (not meth(value)) ^ invert:
return False
else: