MCPcopy Index your code
hub / github.com/RustPython/RustPython / addCleanup

Method addCleanup

Lib/unittest/case.py:472–478  ·  view source on GitHub ↗

Add a function, with arguments, to be called when the test is completed. Functions added are called on a LIFO basis and are called after tearDown on test failure or success. Cleanup items are called even if setUp fails (unlike tearDown).

(self, function, /, *args, **kwargs)

Source from the content-addressed store, hash-verified

470 self._type_equality_funcs[typeobj] = function
471
472 def addCleanup(self, function, /, *args, **kwargs):
473 """Add a function, with arguments, to be called when the test is
474 completed. Functions added are called on a LIFO basis and are
475 called after tearDown on test failure or success.
476
477 Cleanup items are called even if setUp fails (unlike tearDown)."""
478 self._cleanups.append((function, args, kwargs))
479
480 def enterContext(self, cm):
481 """Enters the supplied context manager.

Callers 15

test_open_templateMethod · 0.95
set_event_loopMethod · 0.95
addAsyncCleanupMethod · 0.80
setUpMethod · 0.80
test_securityMethod · 0.80
setUpMethod · 0.80
test_bug691291Method · 0.80
test_openMethod · 0.80
test_seek0Method · 0.80
setUpMethod · 0.80
test_codecs_lookupMethod · 0.80
test_closeMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by 15

test_open_templateMethod · 0.76
setUpMethod · 0.64
test_securityMethod · 0.64
setUpMethod · 0.64
test_bug691291Method · 0.64
test_openMethod · 0.64
test_seek0Method · 0.64
setUpMethod · 0.64
test_codecs_lookupMethod · 0.64
test_closeMethod · 0.64