From 5f4e55fb6d01a1dd199ed0f484e460be7d0e222a Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 30 Dec 2020 17:34:00 +0200 Subject: runner: remove dead code in teardown_all() When the stack is empty, the finalizers which are supposed to be attached to nodes in the stack really ought to be empty as well. So the code here is dead. If this doesn't happen, the assert will trigger. --- src/_pytest/runner.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/_pytest/runner.py b/src/_pytest/runner.py index e132a2d8f..017573cec 100644 --- a/src/_pytest/runner.py +++ b/src/_pytest/runner.py @@ -480,8 +480,6 @@ class SetupState: def teardown_all(self) -> None: while self.stack: self._pop_and_teardown() - for key in list(self._finalizers): - self._teardown_with_finalization(key) assert not self._finalizers -- cgit v1.2.3