fixtures: use node.ihook instead of open-coding it
This commit is contained in:
parent
4c8fb6f0af
commit
6672a10354
|
@ -992,8 +992,8 @@ class FixtureDef(Generic[FixtureValue]):
|
||||||
if exc:
|
if exc:
|
||||||
raise exc
|
raise exc
|
||||||
finally:
|
finally:
|
||||||
hook = self._fixturemanager.session.gethookproxy(request.node.path)
|
ihook = request.node.ihook
|
||||||
hook.pytest_fixture_post_finalizer(fixturedef=self, request=request)
|
ihook.pytest_fixture_post_finalizer(fixturedef=self, request=request)
|
||||||
# Even if finalization fails, we invalidate the cached fixture
|
# Even if finalization fails, we invalidate the cached fixture
|
||||||
# value and remove all finalizers because they may be bound methods
|
# value and remove all finalizers because they may be bound methods
|
||||||
# which will keep instances alive.
|
# which will keep instances alive.
|
||||||
|
@ -1027,8 +1027,8 @@ class FixtureDef(Generic[FixtureValue]):
|
||||||
self.finish(request)
|
self.finish(request)
|
||||||
assert self.cached_result is None
|
assert self.cached_result is None
|
||||||
|
|
||||||
hook = self._fixturemanager.session.gethookproxy(request.node.path)
|
ihook = request.node.ihook
|
||||||
result = hook.pytest_fixture_setup(fixturedef=self, request=request)
|
result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def cache_key(self, request: SubRequest) -> object:
|
def cache_key(self, request: SubRequest) -> object:
|
||||||
|
|
Loading…
Reference in New Issue