MCPcopy Create free account
hub / github.com/pytest-dev/pytest / from_parent

Method from_parent

src/_pytest/nodes.py:249–264  ·  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

247
248 @classmethod
249 def from_parent(cls, parent: "Node", **kw):
250 """Public constructor for Nodes.
251
252 This indirection got introduced in order to enable removing
253 the fragile logic from the node constructors.
254
255 Subclasses can use ``super().from_parent(...)`` when overriding the
256 construction.
257
258 :param parent: The parent node of this Node.
259 """
260 if "config" in kw:
261 raise TypeError("config is not a valid argument for from_parent")
262 if "session" in kw:
263 raise TypeError("session is not a valid argument for from_parent")
264 return cls._create(parent=parent, **kw)
265
266 @property
267 def ihook(self):

Callers 5

from_parentMethod · 0.45
collectMethod · 0.45
pytest_collect_fileFunction · 0.45
collectMethod · 0.45

Calls 1

_createMethod · 0.80

Tested by 4

collectMethod · 0.36
pytest_collect_fileFunction · 0.36
collectMethod · 0.36