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

Method _create

src/_pytest/nodes.py:99–116  ·  view source on GitHub ↗
(cls: type[_T], *k, **kw)

Source from the content-addressed store, hash-verified

97 fail(msg, pytrace=False)
98
99 def _create(cls: type[_T], *k, **kw) -> _T:
100 try:
101 return super().__call__(*k, **kw) # type: ignore[no-any-return,misc]
102 except TypeError:
103 sig = signature(getattr(cls, "__init__"))
104 known_kw = {k: v for k, v in kw.items() if k in sig.parameters}
105 from .warning_types import PytestDeprecationWarning
106
107 warnings.warn(
108 PytestDeprecationWarning(
109 f"{cls} is not using a cooperative constructor and only takes {set(known_kw)}.\n"
110 "See https://docs.pytest.org/en/stable/deprecations.html"
111 "#constructors-of-custom-pytest-node-subclasses-should-take-kwargs "
112 "for more details."
113 )
114 )
115
116 return super().__call__(*k, **known_kw) # type: ignore[no-any-return,misc]
117
118
119class Node(abc.ABC, metaclass=NodeMeta):

Callers 3

from_parentMethod · 0.80
from_configMethod · 0.80
MetafuncMethod · 0.80

Calls 4

signatureFunction · 0.90
__call__Method · 0.45
warnMethod · 0.45

Tested by

no test coverage detected