Skip to main content

ContextMock

Mock that mocks :keyword:with statement contexts.

def ContextMock(
*args: any,
**kwargs: any
) - > _ContextMock

Mock that mocks :keyword:with statement contexts.

Parameters

NameTypeDescription
*argsanyPositional arguments passed to the underlying _ContextMock constructor.
**kwargsanyKeyword arguments passed to the underlying _ContextMock constructor.

Returns

TypeDescription
_ContextMockA mock object configured to act as a context manager, where enter returns the mock itself and exit returns None to ensure exceptions are not suppressed.