You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally reported by: Ionel Cristian Mărieș (BitBucket: ionelmc, GitHub: ionelmc)
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)
In retrospect I think my usecase was wrong and I misunderstood things. I expected the method to be bound to an arbitrary object (some instance I register in the plugin manager).
Originally reported by: Ionel Cristian Mărieș (BitBucket: ionelmc, GitHub: ionelmc)
In
python.py
there's code like thisIf 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.
The text was updated successfully, but these errors were encountered: