diff --git a/addons/test_mail/tests/test_discuss.py b/addons/test_mail/tests/test_discuss.py index e2bda7dc8d9..dfd4834e0ce 100644 --- a/addons/test_mail/tests/test_discuss.py +++ b/addons/test_mail/tests/test_discuss.py @@ -2,9 +2,11 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.addons.test_mail.tests.common import TestMailCommon, TestRecipients +from odoo.tests import tagged from odoo.tools import mute_logger +@tagged('post_install', '-at_install') class TestChatterTweaks(TestMailCommon, TestRecipients): @classmethod diff --git a/addons/test_mail/tests/test_invite.py b/addons/test_mail/tests/test_invite.py index c4e91a86173..f859676b722 100644 --- a/addons/test_mail/tests/test_invite.py +++ b/addons/test_mail/tests/test_invite.py @@ -2,9 +2,11 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.addons.test_mail.tests.common import TestMailCommon +from odoo.tests import tagged from odoo.tools import mute_logger +@tagged('post_install', '-at_install') class TestInvite(TestMailCommon): @mute_logger('odoo.addons.mail.models.mail_mail') diff --git a/addons/test_mail/tests/test_ir_actions.py b/addons/test_mail/tests/test_ir_actions.py index d67124b2153..d189a656569 100644 --- a/addons/test_mail/tests/test_ir_actions.py +++ b/addons/test_mail/tests/test_ir_actions.py @@ -3,8 +3,10 @@ from odoo.addons.base.tests.test_ir_actions import TestServerActionsBase from odoo.addons.test_mail.tests.common import TestMailCommon +from odoo.tests import tagged +@tagged('post_install', '-at_install') class TestServerActionsEmail(TestMailCommon, TestServerActionsBase): def test_action_email(self): diff --git a/addons/test_mail/tests/test_mail_activity.py b/addons/test_mail/tests/test_mail_activity.py index 7fe7ba51981..b159d661fbd 100644 --- a/addons/test_mail/tests/test_mail_activity.py +++ b/addons/test_mail/tests/test_mail_activity.py @@ -24,7 +24,7 @@ class TestActivityCommon(TestMailCommon): cls._reset_mail_context(cls.test_record) -@tests.tagged('mail_activity') +@tests.tagged('mail_activity', 'post_install', '-at_install') class TestActivityRights(TestActivityCommon): @mute_logger('odoo.addons.mail.models.mail_mail') @@ -85,7 +85,7 @@ class TestActivityRights(TestActivityCommon): user_id=self.user_admin.id) -@tests.tagged('mail_activity') +@tests.tagged('mail_activity', 'post_install', '-at_install') class TestActivityFlow(TestActivityCommon): def test_activity_flow_employee(self): @@ -149,7 +149,7 @@ class TestActivityFlow(TestActivityCommon): self.assertEqual(activity.user_id, self.user_employee) -@tests.tagged('mail_activity') +@tests.tagged('mail_activity', 'post_install', '-at_install') class TestActivityMixin(TestActivityCommon): @mute_logger('odoo.addons.mail.models.mail_mail') diff --git a/addons/test_mail/tests/test_mail_channel.py b/addons/test_mail/tests/test_mail_channel.py index 2e3c7c2cb4b..d10bcf3ee10 100644 --- a/addons/test_mail/tests/test_mail_channel.py +++ b/addons/test_mail/tests/test_mail_channel.py @@ -8,6 +8,7 @@ from odoo.exceptions import AccessError, except_orm, ValidationError, UserError from odoo.tools import mute_logger, formataddr +@tagged('post_install', '-at_install') class TestChannelAccessRights(TestMailCommon): @classmethod @@ -111,6 +112,7 @@ class TestChannelAccessRights(TestMailCommon): trigger_read = partner.with_user(self.user_portal).name +@tagged('post_install', '-at_install') class TestChannelFeatures(TestMailCommon): @classmethod @@ -208,7 +210,7 @@ class TestChannelFeatures(TestMailCommon): self.assertEqual(infos[0]['direct_partner'][0]['out_of_office_message'], 'Out') -@tagged('moderation') +@tagged('moderation', 'post_install', '-at_install') class TestChannelModeration(TestMailCommon): @classmethod diff --git a/addons/test_mail/tests/test_mail_followers.py b/addons/test_mail/tests/test_mail_followers.py index f3b1957d6c6..dec8b8d9879 100644 --- a/addons/test_mail/tests/test_mail_followers.py +++ b/addons/test_mail/tests/test_mail_followers.py @@ -4,9 +4,11 @@ from psycopg2 import IntegrityError from odoo.addons.test_mail.tests.common import TestMailCommon +from odoo.tests import tagged from odoo.tools.misc import mute_logger +@tagged('post_install', '-at_install') class BaseFollowersTest(TestMailCommon): @classmethod @@ -117,6 +119,7 @@ class BaseFollowersTest(TestMailCommon): }) +@tagged('post_install', '-at_install') class AdvancedFollowersTest(TestMailCommon): @classmethod def setUpClass(cls): diff --git a/addons/test_mail/tests/test_mail_gateway.py b/addons/test_mail/tests/test_mail_gateway.py index d9da245a1e0..a70777b4f08 100644 --- a/addons/test_mail/tests/test_mail_gateway.py +++ b/addons/test_mail/tests/test_mail_gateway.py @@ -16,7 +16,7 @@ from odoo.tests import tagged from odoo.tools import email_split_and_format, formataddr, mute_logger -@tagged('mail_gateway') +@tagged('mail_gateway', 'post_install', '-at_install') class TestEmailParsing(TestMailCommon): def test_message_parse_body(self): @@ -70,7 +70,7 @@ class TestEmailParsing(TestMailCommon): self.env['mail.thread'].message_parse(self.from_string(test_mail_data.MAIL_XHTML)) -@tagged('mail_gateway') +@tagged('mail_gateway', 'post_install', '-at_install') class TestMailAlias(TestMailCommon): def test_alias_setup(self): @@ -78,7 +78,7 @@ class TestMailAlias(TestMailCommon): self.assertEqual(alias.alias_name, 'b4r+_-_r3wl-', 'Disallowed chars should be replaced by hyphens') -@tagged('mail_gateway') +@tagged('mail_gateway', 'post_install', '-at_install') class TestMailgateway(TestMailCommon): @classmethod @@ -737,6 +737,7 @@ class TestMailgateway(TestMailCommon): self.assertEqual(record._name, 'mail.test.gateway') +@tagged('post_install', '-at_install') class TestMailThreadCC(TestMailCommon): @classmethod diff --git a/addons/test_mail/tests/test_mail_mail.py b/addons/test_mail/tests/test_mail_mail.py index 7e6b0f98ba2..a65a3c1b3fa 100644 --- a/addons/test_mail/tests/test_mail_mail.py +++ b/addons/test_mail/tests/test_mail_mail.py @@ -6,10 +6,11 @@ import psycopg2 from odoo import api from odoo.addons.base.models.ir_mail_server import MailDeliveryException from odoo.addons.test_mail.tests.common import TestMailCommon -from odoo.tests import common +from odoo.tests import common, tagged from odoo.tools import mute_logger +@tagged('post_install', '-at_install') class TestMailMail(TestMailCommon): @mute_logger('odoo.addons.mail.models.mail_mail') @@ -36,6 +37,7 @@ class TestMailMail(TestMailCommon): self.assertRaises(MailDeliveryException, lambda: mail.send(raise_exception=True)) +@tagged('post_install', '-at_install') class TestMailMailRace(common.TransactionCase): @mute_logger('odoo.addons.mail.models.mail_mail') diff --git a/addons/test_mail/tests/test_mail_message.py b/addons/test_mail/tests/test_mail_message.py index 2ff5c6f7d5f..5ce9ffa0469 100644 --- a/addons/test_mail/tests/test_mail_message.py +++ b/addons/test_mail/tests/test_mail_message.py @@ -6,10 +6,11 @@ import base64 from odoo.addons.mail.tests.common import mail_new_test_user from odoo.addons.test_mail.tests.common import TestMailCommon from odoo.exceptions import AccessError, except_orm -from odoo.tools import mute_logger, formataddr from odoo.tests import tagged +from odoo.tools import mute_logger, formataddr +@tagged('post_install', '-at_install') class TestMessageValues(TestMailCommon): @classmethod diff --git a/addons/test_mail/tests/test_mail_template.py b/addons/test_mail/tests/test_mail_template.py index a845ffc0a79..de323fed812 100644 --- a/addons/test_mail/tests/test_mail_template.py +++ b/addons/test_mail/tests/test_mail_template.py @@ -4,9 +4,11 @@ import base64 from odoo.addons.test_mail.tests.common import TestMailCommon, TestRecipients +from odoo.tests import tagged from odoo.tools import mute_logger +@tagged('post_install', '-at_install') class TestMailTemplate(TestMailCommon, TestRecipients): @classmethod diff --git a/addons/test_mail/tests/test_message_composer.py b/addons/test_mail/tests/test_message_composer.py index e94b5a533c3..1ff2ea4cab4 100644 --- a/addons/test_mail/tests/test_message_composer.py +++ b/addons/test_mail/tests/test_message_composer.py @@ -7,9 +7,11 @@ from unittest.mock import patch from odoo.addons.test_mail.tests.common import TestMailCommon, TestRecipients from odoo.addons.test_mail.models.test_mail_models import MailTestSimple +from odoo.tests import tagged from odoo.tools import mute_logger +@tagged('post_install', '-at_install') class TestComposer(TestMailCommon, TestRecipients): @classmethod @@ -153,6 +155,7 @@ class TestComposer(TestMailCommon, TestRecipients): self.assertEqual(self.test_record.message_ids[0].author_id, portal_user.partner_id) +@tagged('post_install', '-at_install') class TestComposerWTpl(TestMailCommon, TestRecipients): @classmethod diff --git a/addons/test_mail/tests/test_message_management.py b/addons/test_mail/tests/test_message_management.py index b2c437ce2db..02e95798514 100644 --- a/addons/test_mail/tests/test_message_management.py +++ b/addons/test_mail/tests/test_message_management.py @@ -7,7 +7,7 @@ from odoo.tests import tagged from odoo.tools import mute_logger -@tagged('mail_wizards') +@tagged('mail_wizards', 'post_install', '-at_install') class TestMailResend(TestMailCommon): @classmethod diff --git a/addons/test_mail/tests/test_message_post.py b/addons/test_mail/tests/test_message_post.py index 8e0a06320fb..5b99717caa8 100644 --- a/addons/test_mail/tests/test_message_post.py +++ b/addons/test_mail/tests/test_message_post.py @@ -9,9 +9,11 @@ from odoo.addons.test_mail.data.test_mail_data import MAIL_TEMPLATE_PLAINTEXT from odoo.addons.test_mail.models.test_mail_models import MailTestSimple from odoo.addons.test_mail.tests.common import TestMailCommon, TestRecipients from odoo.exceptions import AccessError +from odoo.tests import tagged from odoo.tools import mute_logger, formataddr +@tagged('post_install', '-at_install') class TestMessagePost(TestMailCommon, TestRecipients): @classmethod diff --git a/addons/test_mail/tests/test_message_track.py b/addons/test_mail/tests/test_message_track.py index 61d64a70abe..df260ee3b65 100644 --- a/addons/test_mail/tests/test_message_track.py +++ b/addons/test_mail/tests/test_message_track.py @@ -4,8 +4,10 @@ from unittest.mock import patch from odoo.addons.test_mail.tests.common import TestMailCommon +from odoo.tests import tagged +@tagged('post_install', '-at_install') class TestTracking(TestMailCommon): def setUp(self): diff --git a/addons/test_mail/tests/test_odoobot.py b/addons/test_mail/tests/test_odoobot.py index 740a0444974..67b0e499ff0 100644 --- a/addons/test_mail/tests/test_odoobot.py +++ b/addons/test_mail/tests/test_odoobot.py @@ -8,7 +8,7 @@ from odoo.tests import tagged from odoo.tools import mute_logger -@tagged("odoobot") +@tagged("odoobot", 'post_install', '-at_install') class TestOdoobot(TestMailCommon, TestRecipients): @classmethod diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index 6cdc637ccf3..9e04c4b02c8 100644 --- a/addons/test_mail/tests/test_performance.py +++ b/addons/test_mail/tests/test_performance.py @@ -3,12 +3,12 @@ import base64 from odoo.addons.base.tests.common import TransactionCaseWithUserDemo -from odoo.tests.common import TransactionCase, users, warmup +from odoo.tests.common import users, warmup from odoo.tests import tagged from odoo.tools import mute_logger, formataddr -@tagged('mail_performance') +@tagged('mail_performance', 'post_install', '-at_install') class BaseMailPerformance(TransactionCaseWithUserDemo): def setUp(self): @@ -32,7 +32,7 @@ class BaseMailPerformance(TransactionCaseWithUserDemo): self.patch(self.env.registry, 'ready', True) -@tagged('mail_performance') +@tagged('mail_performance', 'post_install', '-at_install') class TestMailPerformance(BaseMailPerformance): def setUp(self): @@ -167,7 +167,7 @@ class TestMailPerformance(BaseMailPerformance): }) -@tagged('mail_performance') +@tagged('mail_performance', 'post_install', '-at_install') class TestMailAPIPerformance(BaseMailPerformance): def setUp(self): @@ -226,11 +226,11 @@ class TestMailAPIPerformance(BaseMailPerformance): 'res_id': record.id, 'activity_type_id': self.env.ref('mail.mail_activity_data_todo').id, }) - #read activity_type to normalize cache between enterprise and community - #voip module read activity_type during create leading to one less query in enterprise on action_feedback - category = activity.activity_type_id.category + # read activity_type to normalize cache between enterprise and community + # voip module read activity_type during create leading to one less query in enterprise on action_feedback + activity.activity_type_id.category - with self.assertQueryCount(__system__=19, emp=22): + with self.assertQueryCount(__system__=19 + 1, emp=22 + 1): activity.action_feedback(feedback='Zizisse Done !') @users('__system__', 'emp') @@ -241,13 +241,13 @@ class TestMailAPIPerformance(BaseMailPerformance): with self.assertQueryCount(__system__=8, emp=8): activity = record.action_start('Test Start') - #read activity_type to normalize cache between enterprise and community - #voip module read activity_type during create leading to one less query in enterprise on action_close - category = activity.activity_type_id.category + # read activity_type to normalize cache between enterprise and community + # voip module read activity_type during create leading to one less query in enterprise on action_close + activity.activity_type_id.category record.write({'name': 'Dupe write'}) - with self.assertQueryCount(__system__=20, emp=22): + with self.assertQueryCount(__system__=20 + 1, emp=22 + 1): record.action_close('Dupe feedback') self.assertEqual(record.activity_ids, self.env['mail.activity']) @@ -268,7 +268,7 @@ class TestMailAPIPerformance(BaseMailPerformance): 'partner_ids': [(4, customer_id)], }) - with self.assertQueryCount(__system__=38, emp=44): + with self.assertQueryCount(__system__=38 + 1, emp=44 + 1): composer.send_mail() @users('__system__', 'emp') @@ -278,7 +278,7 @@ class TestMailAPIPerformance(BaseMailPerformance): test_record = self.env['mail.test.full'].browse(self.test_record_full.id) test_template = self.env['mail.template'].browse(self.test_template_full.id) # TODO XDO/TDE FIXME non deterministic between 25 and 28 queries - with self.assertQueryCount(__system__=28, emp=28): + with self.assertQueryCount(__system__=21 + 12, emp=21 + 12): composer = self.env['mail.compose.message'].with_context({ 'default_composition_mode': 'comment', 'default_model': test_record._name, @@ -287,7 +287,7 @@ class TestMailAPIPerformance(BaseMailPerformance): }).create({}) composer.onchange_template_id_wrapper() - with self.assertQueryCount(__system__=46, emp=51): + with self.assertQueryCount(__system__=46 + 1, emp=51 + 1): composer.send_mail() # remove created partner to ensure tests are the same each run @@ -299,7 +299,7 @@ class TestMailAPIPerformance(BaseMailPerformance): def test_message_assignation_email(self): self.user_test.write({'notification_type': 'email'}) record = self.env['mail.test.track'].create({'name': 'Test'}) - with self.assertQueryCount(__system__=40, emp=41): + with self.assertQueryCount(__system__=40 + 2, emp=41 + 2): record.write({ 'user_id': self.user_test.id, }) @@ -308,7 +308,7 @@ class TestMailAPIPerformance(BaseMailPerformance): @warmup def test_message_assignation_inbox(self): record = self.env['mail.test.track'].create({'name': 'Test'}) - with self.assertQueryCount(__system__=27, emp=29): + with self.assertQueryCount(__system__=27 + 1, emp=29 + 1): record.write({ 'user_id': self.user_test.id, }) @@ -352,7 +352,7 @@ class TestMailAPIPerformance(BaseMailPerformance): def test_message_post_one_email_notification(self): record = self.env['mail.test.simple'].create({'name': 'Test'}) - with self.assertQueryCount(__system__=33, emp=34): + with self.assertQueryCount(__system__=33 + 1, emp=34 + 1): record.message_post( body='
Test Post Performances with an email ping
', partner_ids=self.customer.ids, @@ -397,7 +397,7 @@ class TestMailAPIPerformance(BaseMailPerformance): record.message_subscribe(partner_ids=self.user_test.partner_id.ids, subtype_ids=subtype_ids) -@tagged('mail_performance') +@tagged('mail_performance', 'post_install', '-at_install') class TestMailComplexPerformance(BaseMailPerformance): def setUp(self): @@ -472,7 +472,7 @@ class TestMailComplexPerformance(BaseMailPerformance): self.umbrella.message_subscribe(self.user_portal.partner_id.ids) record = self.umbrella.with_user(self.env.user) - with self.assertQueryCount(__system__=73, emp=74): + with self.assertQueryCount(__system__=73 + 1, emp=74 + 1): record.message_post( body='Test Post Performances
', message_type='comment', @@ -489,7 +489,7 @@ class TestMailComplexPerformance(BaseMailPerformance): record = self.umbrella.with_user(self.env.user) template_id = self.env.ref('test_mail.mail_test_tpl').id - with self.assertQueryCount(__system__=84, emp=85): + with self.assertQueryCount(__system__=84 + 3, emp=85 + 3): record.message_post_with_template(template_id, message_type='comment', composition_mode='comment') self.assertEqual(record.message_ids[0].body, 'Adding stuff on %s
' % record.name) @@ -560,7 +560,7 @@ class TestMailComplexPerformance(BaseMailPerformance): }) rec1 = rec.with_context(active_test=False) # to see inactive records self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id) - with self.assertQueryCount(__system__=39, emp=40): + with self.assertQueryCount(__system__=39 + 2, emp=40 + 2): rec.write({'user_id': self.user_portal.id}) self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id) # write tracking message @@ -580,7 +580,7 @@ class TestMailComplexPerformance(BaseMailPerformance): customer_id = self.customer.id user_id = self.user_portal.id - with self.assertQueryCount(__system__=123, emp=124): + with self.assertQueryCount(__system__=123 + 3, emp=124 + 3): rec = self.env['mail.test.full'].create({ 'name': 'Test', 'umbrella_id': umbrella_id, @@ -609,11 +609,11 @@ class TestMailComplexPerformance(BaseMailPerformance): rec1 = rec.with_context(active_test=False) # to see inactive records self.assertEqual(rec1.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id) self.assertEqual(len(rec1.message_ids), 1) - with self.assertQueryCount(__system__=87, emp=88): + with self.assertQueryCount(__system__=87 + 1, emp=88 + 1): rec.write({ 'name': 'Test2', 'umbrella_id': self.umbrella.id, - }) + }) self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id) # write tracking message @@ -646,13 +646,12 @@ class TestMailComplexPerformance(BaseMailPerformance): rec1 = rec.with_context(active_test=False) # to see inactive records self.assertEqual(rec1.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id) - with self.assertQueryCount(__system__=95, emp=96): + with self.assertQueryCount(__system__=95 + 1, emp=96 + 1): rec.write({ 'name': 'Test2', 'umbrella_id': umbrella_id, 'customer_id': customer_id, - }) - + }) self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id) # write tracking message @@ -680,7 +679,7 @@ class TestMailComplexPerformance(BaseMailPerformance): rec1 = rec.with_context(active_test=False) # to see inactive records self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id) - with self.assertQueryCount(__system__=34, emp=35): + with self.assertQueryCount(__system__=34 + 1, emp=35 + 1): rec.write({ 'name': 'Test2', 'customer_id': customer_id, @@ -699,7 +698,7 @@ class TestMailComplexPerformance(BaseMailPerformance): self.assertEqual(len(rec1.message_ids), 3) -@tagged('mail_performance') +@tagged('mail_performance', 'post_install', '-at_install') class TestMailHeavyPerformancePost(BaseMailPerformance): def setUp(self): @@ -817,7 +816,7 @@ class TestMailHeavyPerformancePost(BaseMailPerformance): ] self.attachements = self.env['ir.attachment'].with_user(self.env.user).create(self.vals) attachement_ids = self.attachements.ids - with self.assertQueryCount(emp=92): + with self.assertQueryCount(emp=92 + 17): self.cr.sql_log = self.warm and self.cr.sql_log_count record.with_context({}).message_post( body='Test body