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