PyDocs

Nav

Development Tools

ThreadingMock

unittest.mock

class · Added in 3.13 (source)
  • ThreadingMock(spec=None, side_effect=None, return_value=DEFAULT, wraps=None, name=None, spec_set=None, unsafe=False, *, timeout=UNSET, **kwargs)
A mock that can be used to wait until on calls happening
in a different thread.

The constructor can take a `timeout` argument which
controls the timeout in seconds for all `wait` calls of the mock.

You can change the default timeout of all instances via the
`ThreadingMock.DEFAULT_TIMEOUT` attribute.

If no timeout is set, it will block undefinetively.
Members of ThreadingMock

d

DEFAULT_TIMEOUT
Global default timeout in seconds to create instances of ThreadingMock.

w

wait_until_any_call_with
Wait until the mock object is called with given args.
wait_until_called
Wait until the mock object is called.
0 Examples
No examples for unittest.mock/ThreadingMock.
See Also
No see-alsos for unittest.mock/ThreadingMock
0 Notes
No notes for ThreadingMock