def METHOD_NAME(self, handle_method):
    handle_method.side_effect = CommandError('error during the command')
    empty_outbox()
    with self.assertRaises(CommandError):
        call_command(EmailOnFailureCommand(), '--no-failure-email')
    self.assertEqual(len(outbox), 0)