New issue 674: Fixtures from methods wrongly get rebound to request.instance https://bitbucket.org/hpk42/pytest/issue/674/fixtures-from-methods-wrongly-get-rebound
Ionel Maries Cristian: In `python.py` there's code like this ``` if self.unittest: result = self.func(request.instance, **kwargs) else: fixturefunc = self.func # the fixture function needs to be bound to the actual # request.instance so that code working with "self" behaves # as expected. if request.instance is not None: fixturefunc = getimfunc(self.func) if fixturefunc != self.func: fixturefunc = fixturefunc.__get__(request.instance) try: result = call_fixture_func(fixturefunc, request, kwargs, self.yieldctx) except Exception: self.cached_result = (None, my_cache_key, sys.exc_info()) raise self.cached_result = (result, my_cache_key, None) ``` If you create a fixture from a plugin like this: https://github.com/ionelmc/pytest-benchmark/blob/9f2c62affb62d580f115d72f99cb662306bfa1d2/src/pytest_benchmark/plugin.py#L294 then you're going to have the request.instance as self. _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit