Ronny Pfannschmidt  committed bb0752e

exchange the rawcode factory marker check with a more robust and specific instance check as advised by holger

  • Participants
  • Parent commits 60f144d
  • Branches default

Comments (0)

Files changed (1)

File _pytest/

             obj = getattr(holderobj, name)
             if not callable(obj):
-            # to avoid breaking on magic global callables
-            # we explicitly check if we get a sane code object
-            # else having in the globals fails for example
-            code = py.code.getrawcode(obj)
-            if not inspect.iscode(code):
-                continue
             # resource factories either have a pytest_funcarg__ prefix
             # or are "funcarg" marked
             marker = getattr(obj, "_pytestfactory", None)
             if marker is not None:
+                if not isinstance(marker, FactoryMarker):
+                    # magic globals  with __getattr__
+                    # give us something thats wrong for that case
+                    continue
                 assert not name.startswith(self._argprefix)
                 argname = name
                 scope = marker.scope