OCA / pylint-odoo

Odoo plugin for Pylint
http://www.pylint.org
143 stars 168 forks source link

Pylint requiring translations in tests #321

Closed joao-p-marques closed 3 years ago

joao-p-marques commented 3 years ago

Pylint is requiring translation of strings in a test when message_post is called.

Code:

def test_email_subject_template_multi(self):
        # ....
        mail_message_1 = self.partner_1.message_post(
            body="Test", subtype="mail.mt_comment"
        )
        # ...
        mail_message_2 = self.partner_1.message_post(
            body="Test", subtype="mail.mt_comment"
        )
        # ...
        mail_message_3 = self.partner_1.message_post(
            body="Test", subtype="mail.mt_comment"
        )

See https://github.com/OCA/social/pull/671 for the full code. (You wont be able to see the log there as it has been solved with # pylint: disable=C8107).

Pre-commit outputs:

pylint with optional checks..............................................Passed
- hook id: pylint
- duration: 4.82s

************* Module mail_notification_custom_subject.tests.test_mail_notification_custom_subject
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:35: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_overrides] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:42: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_overrides] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:49: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_overrides] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:49: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_overrides] String parameter on "message_post" requires translation. Use subject=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:65: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_normal] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:65: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_normal] String parameter on "message_post" requires translation. Use subject=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:89: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_multi] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:106: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_multi] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:124: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_multi] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:144: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_w_original] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:144: [C8107(translation-required), TestMailNotificationCustomSubject.test_email_subject_template_w_original] String parameter on "message_post" requires translation. Use subject=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:161: [C8107(translation-required), TestMailNotificationCustomSubject.test_bad_template_does_not_break] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:161: [C8107(translation-required), TestMailNotificationCustomSubject.test_bad_template_does_not_break] String parameter on "message_post" requires translation. Use subject=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:170: [C8107(translation-required), TestMailNotificationCustomSubject.test_no_template_default_result] String parameter on "message_post" requires translation. Use body=_('Test')
mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py:170: [C8107(translation-required), TestMailNotificationCustomSubject.test_no_template_default_result] String parameter on "message_post" requires translation. Use subject=_('Test partner 1')

and the same for mandatory checks.

@Tecnativa TT28063

ping @Yajo @CarlosRoca13