MCPcopy Index your code
hub / github.com/python/cpython / enterContext

Method enterContext

Lib/unittest/case.py:473–479  ·  view source on GitHub ↗

Enters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method.

(self, cm)

Source from the content-addressed store, hash-verified

471 self._cleanups.append((function, args, kwargs))
472
473 def enterContext(self, cm):
474 """Enters the supplied context manager.
475
476 If successful, also adds its __exit__ method as a cleanup
477 function and returns the result of the __enter__ method.
478 """
479 return _enter_context(cm, self.addCleanup)
480
481 @classmethod
482 def addClassCleanup(cls, function, /, *args, **kwargs):

Callers 15

setUpMethod · 0.95
setUpMethod · 0.80
setUpMethod · 0.80
setUpMethod · 0.80
test_poll2Method · 0.80
setUpMethod · 0.80
setUpMethod · 0.80
test_recv_zeroMethod · 0.80

Calls 1

_enter_contextFunction · 0.85

Tested by 15

setUpMethod · 0.76
setUpMethod · 0.64
setUpMethod · 0.64
setUpMethod · 0.64
test_poll2Method · 0.64
setUpMethod · 0.64
setUpMethod · 0.64
test_recv_zeroMethod · 0.64