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):
278
278
self ._finalizers = {}
279
279
280
280
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. """
285
282
assert colitem and not isinstance (colitem , tuple )
286
283
assert callable (finalizer )
287
284
# assert colitem in self.stack # some unit tests don't setup stack :/
@@ -309,12 +306,9 @@ def _callfinalizers(self, colitem):
309
306
310
307
def _teardown_with_finalization (self , colitem ):
311
308
self ._callfinalizers (colitem )
312
- if hasattr (colitem , "teardown" ):
313
- colitem .teardown ()
309
+ colitem .teardown ()
314
310
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
318
312
319
313
def teardown_all (self ):
320
314
while self .stack :
You can’t perform that action at this time.
0 commit comments