runner: schedule node.teardown() call already at setup

This is more elegant.
This commit is contained in:
Ran Benita 2021-01-01 22:03:52 +02:00
parent 1db78bec31
commit 0d19aff562
1 changed files with 1 additions and 2 deletions

View File

@ -422,7 +422,7 @@ class SetupState:
needed_collectors = colitem.listchain()
for col in needed_collectors[len(self.stack) :]:
assert col not in self.stack
self.stack[col] = []
self.stack[col] = [col.teardown]
try:
col.setup()
except TEST_OUTCOME as e:
@ -443,7 +443,6 @@ class SetupState:
if list(self.stack.keys()) == needed_collectors[: len(self.stack)]:
break
colitem, finalizers = self.stack.popitem()
finalizers.insert(0, colitem.teardown)
while finalizers:
fin = finalizers.pop()
try: