From f8169fc1aaf21642478f4538fc0e0f04c5e8b1a9 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 0bf27bcfaf..585edd65d6 100644 --- a/src/_pytest/_py/path.py +++ b/src/_pytest/_py/path.py @@ -109,6 +109,8 @@ def endswith(self, arg): 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 @@ def _evaluate(self, kw): 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: