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

Method Metafunc

testing/python/metafunc.py:33–51  ·  view source on GitHub ↗
(self, func, config=None)

Source from the content-addressed store, hash-verified

31
32class TestMetafunc:
33 def Metafunc(self, func, config=None) -> python.Metafunc:
34 # The unit tests of this class check if things work correctly
35 # on the funcarg level, so we don't need a full blown
36 # initialization.
37 class FuncFixtureInfoMock:
38 name2fixturedefs = None
39
40 def __init__(self, names):
41 self.names_closure = names
42
43 @attr.s
44 class DefinitionMock(python.FunctionDefinition):
45 obj = attr.ib()
46 _nodeid = attr.ib()
47
48 names = getfuncargnames(func)
49 fixtureinfo: Any = FuncFixtureInfoMock(names)
50 definition: Any = DefinitionMock._create(func, "mock::nodeid")
51 return python.Metafunc(definition, fixtureinfo, config, _ispytest=True)
52
53 def test_no_funcargs(self) -> None:
54 def function():

Calls 3

getfuncargnamesFunction · 0.90
FuncFixtureInfoMockClass · 0.85
_createMethod · 0.80