def METHOD_NAME(self, handle_method):
    class _SubclassCommand(EmailOnFailureCommand):
        failure_message = 'simple message with the {error} and {other}\n'
        failure_recipients = 'someone@example.com'
        failure_subject = 'subject of the email'
        def make_failure_message(self, error, **extra):
            msg = super().make_failure_message(error, other='additional info', **extra)
            msg.add_attachment('attached\n')
            return msg
    handle_method.side_effect = CommandError('error during the command')
    empty_outbox()
    with override_settings(
            ADMINS=('a1', 'admin@example.com'),
            SERVER_EMAIL='server@example.com',
    ):
        call_command(_SubclassCommand())
    self.assertEqual(len(outbox), 1)
    msg = outbox[0]
    self.assertEqual(msg['to'], 'someone@example.com',
                     'Outgoing email recipients were not customized')
    self.assertEqual(msg['from'], 'server@example.com',
                     'Outgoing email sender did not default to settings.SERVER_EMAIL')
    self.assertEqual(msg['subject'], 'subject of the email',
                     'Outgoing email subject was not customized')
    self.assertTrue(msg.is_multipart())
    parts = msg.get_payload()
    self.assertEqual(len(parts), 3, 'Attachment was not added')
    self.assertEqual(
        parts[0].get_content(),
        'simple message with the error during the command and additional info\n',
    )
    self.assertIn('error during the command', parts[1].get_content())
    self.assertIn('Traceback', parts[1].get_content())
    self.assertEqual('attached\n', parts[2].get_content())