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)
| 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): |