Merge pull request #7368 from bluetech/teardown-in-setup

runner: don't try to teardown previous items from pytest_runtest_setup
This commit is contained in:
Ran Benita 2020-06-15 19:41:21 +03:00 committed by GitHub
commit 7b77fc086a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -409,16 +409,15 @@ class SetupState:
raise exc
def prepare(self, colitem) -> None:
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
"""Setup objects along the collector chain to the test-method."""
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, "_prepare_exc"):
exc = col._prepare_exc # type: ignore[attr-defined] # noqa: F821
raise exc
needed_collectors = colitem.listchain()
for col in needed_collectors[len(self.stack) :]:
self.stack.append(col)
try: