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)
| 478 | self._cleanups.append((function, args, kwargs)) |
| 479 | |
| 480 | def enterContext(self, cm): |
| 481 | """Enters the supplied context manager. |
| 482 | |
| 483 | If successful, also adds its __exit__ method as a cleanup |
| 484 | function and returns the result of the __enter__ method. |
| 485 | """ |
| 486 | return _enter_context(cm, self.addCleanup) |
| 487 | |
| 488 | @classmethod |
| 489 | def addClassCleanup(cls, function, /, *args, **kwargs): |