Skip to content

Commit 5b9c246

Browse files
committed
support IPython DummyMod as __main__ module for pytest fixtures
1 parent 755083c commit 5b9c246

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/_pytest/fixtures.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1734,8 +1734,11 @@ def parsefactories(
17341734
if holderobj in self._holderobjseen:
17351735
return
17361736

1737+
module_types = (types.ModuleType,)
1738+
if (DummyMod := getattr(sys.modules.get("IPython.core.interactiveshell"), "DummyMod", None)) is not None:
1739+
module_types += (DummyMod,)
17371740
# Avoid accessing `@property` (and other descriptors) when iterating fixtures.
1738-
if not safe_isclass(holderobj) and not isinstance(holderobj, types.ModuleType):
1741+
if not safe_isclass(holderobj) and not isinstance(holderobj, module_types):
17391742
holderobj_tp: object = type(holderobj)
17401743
else:
17411744
holderobj_tp = holderobj

0 commit comments

Comments
 (0)