From 6672a103545f28b7d9fc455538769bb127744889 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 19 Jan 2022 15:42:04 +0200 Subject: [PATCH] fixtures: use node.ihook instead of open-coding it --- src/_pytest/fixtures.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index e0409fcf2..be03fb2a8 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -992,8 +992,8 @@ class FixtureDef(Generic[FixtureValue]): if exc: raise exc finally: - hook = self._fixturemanager.session.gethookproxy(request.node.path) - hook.pytest_fixture_post_finalizer(fixturedef=self, request=request) + ihook = request.node.ihook + ihook.pytest_fixture_post_finalizer(fixturedef=self, request=request) # Even if finalization fails, we invalidate the cached fixture # value and remove all finalizers because they may be bound methods # which will keep instances alive. @@ -1027,8 +1027,8 @@ class FixtureDef(Generic[FixtureValue]): self.finish(request) assert self.cached_result is None - hook = self._fixturemanager.session.gethookproxy(request.node.path) - result = hook.pytest_fixture_setup(fixturedef=self, request=request) + ihook = request.node.ihook + result = ihook.pytest_fixture_setup(fixturedef=self, request=request) return result def cache_key(self, request: SubRequest) -> object: