def __init__( self, name, parent, args=None, config=None, callspec=None, callobj=NOTSET, keywords=None, session=None, fixtureinfo=None, originalname=None, ): super(Function, self).__init__(name, parent, config=config, session=session) self._args = args if callobj is not NOTSET: self.obj = callobj self.keywords.update(self.obj.__dict__) self.own_markers.extend(get_unpacked_marks(self.obj)) if callspec: self.callspec = callspec # this is total hostile and a mess # keywords are broken by design by now # this will be redeemed later for mark in callspec.marks: # feel free to cry, this was broken for years before # and keywords cant fix it per design self.keywords[mark.name] = mark self.own_markers.extend(normalize_mark_list(callspec.marks)) if keywords: self.keywords.update(keywords) # todo: this is a hell of a hack # https://github.com/pytest-dev/pytest/issues/4569 self.keywords.update( dict.fromkeys( [ mark.name for mark in self.iter_markers() if mark.name not in self.keywords ], True, ) ) if fixtureinfo is None: fixtureinfo = self.session._fixturemanager.getfixtureinfo( self, self.obj, self.cls, funcargs=not self._isyieldedfunction() ) self._fixtureinfo = fixtureinfo self.fixturenames = fixtureinfo.names_closure self._initrequest() #: original function name, without any decorations (for example #: parametrization adds a ``"[...]"`` suffix to function names). #: #: .. versionadded:: 3.0 self.originalname = originalname
def setmulti2(self, valtypes, argnames, valset, id, marks, scopenum, param_index): for arg, val in zip(argnames, valset): self._checkargnotcontained(arg) valtype_for_arg = valtypes[arg] getattr(self, valtype_for_arg)[arg] = val self.indices[arg] = param_index self._arg2scopenum[arg] = scopenum self._idlist.append(id) self.marks.extend(normalize_mark_list(marks))