From 965e942dfb4f68d1e28d6388544ff81247a0a4ef Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Wed, 19 Oct 2022 10:56:43 -0400 Subject: [PATCH] use getrawcode from _pytest._code --- src/_pytest/_py/path.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_pytest/_py/path.py b/src/_pytest/_py/path.py index 0bf27bcfa..585edd65d 100644 --- a/src/_pytest/_py/path.py +++ b/src/_pytest/_py/path.py @@ -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: