File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -278,10 +278,7 @@ def __init__(self):
278278 self ._finalizers = {}
279279
280280 def addfinalizer (self , finalizer , colitem ):
281- """ attach a finalizer to the given colitem.
282- if colitem is None, this will add a finalizer that
283- is called at the end of teardown_all().
284- """
281+ """ attach a finalizer to the given colitem. """
285282 assert colitem and not isinstance (colitem , tuple )
286283 assert callable (finalizer )
287284 # assert colitem in self.stack # some unit tests don't setup stack :/
@@ -309,12 +306,9 @@ def _callfinalizers(self, colitem):
309306
310307 def _teardown_with_finalization (self , colitem ):
311308 self ._callfinalizers (colitem )
312- if hasattr (colitem , "teardown" ):
313- colitem .teardown ()
309+ colitem .teardown ()
314310 for colitem in self ._finalizers :
315- assert (
316- colitem is None or colitem in self .stack or isinstance (colitem , tuple )
317- )
311+ assert colitem in self .stack
318312
319313 def teardown_all (self ):
320314 while self .stack :
You can’t perform that action at this time.
0 commit comments