summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2021-01-01 21:48:03 +0200
committerRan Benita <ran@unusedvar.com>2021-01-24 14:08:39 +0200
commit03c3a90c686c4cb0a146e4139125b30cba27075a (patch)
tree45400bca8e34072bd80037b31323ee9e7e096384 /src
parent960ebae943927805091153bfe17677c5f3734198 (diff)
downloadpytest-03c3a90c686c4cb0a146e4139125b30cba27075a.tar.gz
runner: replace setdefault with an unconditional set
The already-exists case is not supposed to happen.
Diffstat (limited to 'src')
-rw-r--r--src/_pytest/runner.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/_pytest/runner.py b/src/_pytest/runner.py
index 9759441bd..fe3590d44 100644
--- a/src/_pytest/runner.py
+++ b/src/_pytest/runner.py
@@ -422,8 +422,10 @@ class SetupState:
needed_collectors = colitem.listchain()
for col in needed_collectors[len(self.stack) :]:
+ assert col not in self.stack
+ assert col not in self._finalizers
self.stack.append(col)
- self._finalizers.setdefault(col, [])
+ self._finalizers[col] = []
try:
col.setup()
except TEST_OUTCOME as e: