It's not entirely clear to me what this is testing - it looks like you're creating a MagicMock, calling it with a TimeoutError, and then asserting that it was called with a TimeoutError. Am I missing something?