MCPcopy
hub / github.com/pytest-dev/pytest / from_parent

Method from_parent

src/_pytest/nodes.py:210–225  ·  view source on GitHub ↗

Public constructor for Nodes. This indirection got introduced in order to enable removing the fragile logic from the node constructors. Subclasses can use ``super().from_parent(...)`` when overriding the construction. :param parent: The parent node of this

(cls, parent: Node, **kw)

Source from the content-addressed store, hash-verified

208
209 @classmethod
210 def from_parent(cls, parent: Node, **kw) -> Self:
211 """Public constructor for Nodes.
212
213 This indirection got introduced in order to enable removing
214 the fragile logic from the node constructors.
215
216 Subclasses can use ``super().from_parent(...)`` when overriding the
217 construction.
218
219 :param parent: The parent node of this Node.
220 """
221 if "config" in kw:
222 raise TypeError("config is not a valid argument for from_parent")
223 if "session" in kw:
224 raise TypeError("session is not a valid argument for from_parent")
225 return cls._create(parent=parent, **kw)
226
227 @property
228 def ihook(self) -> pluggy.HookRelay:

Callers 1

from_parentMethod · 0.45

Calls 1

_createMethod · 0.80

Tested by

no test coverage detected