diff --git a/addons/test_mail/tests/test_discuss.py b/addons/test_mail/tests/test_discuss.py index dfd4834e0ce..e2bda7dc8d9 100644 --- a/addons/test_mail/tests/test_discuss.py +++ b/addons/test_mail/tests/test_discuss.py @@ -2,11 +2,9 @@ # 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 f859676b722..c4e91a86173 100644 --- a/addons/test_mail/tests/test_invite.py +++ b/addons/test_mail/tests/test_invite.py @@ -2,11 +2,9 @@ # 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 d189a656569..d67124b2153 100644 --- a/addons/test_mail/tests/test_ir_actions.py +++ b/addons/test_mail/tests/test_ir_actions.py @@ -3,10 +3,8 @@ 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 b159d661fbd..7fe7ba51981 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', 'post_install', '-at_install') +@tests.tagged('mail_activity') 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', 'post_install', '-at_install') +@tests.tagged('mail_activity') 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', 'post_install', '-at_install') +@tests.tagged('mail_activity') 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 d10bcf3ee10..2e3c7c2cb4b 100644 --- a/addons/test_mail/tests/test_mail_channel.py +++ b/addons/test_mail/tests/test_mail_channel.py @@ -8,7 +8,6 @@ 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 @@ -112,7 +111,6 @@ class TestChannelAccessRights(TestMailCommon): trigger_read = partner.with_user(self.user_portal).name -@tagged('post_install', '-at_install') class TestChannelFeatures(TestMailCommon): @classmethod @@ -210,7 +208,7 @@ class TestChannelFeatures(TestMailCommon): self.assertEqual(infos[0]['direct_partner'][0]['out_of_office_message'], 'Out') -@tagged('moderation', 'post_install', '-at_install') +@tagged('moderation') 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 dec8b8d9879..f3b1957d6c6 100644 --- a/addons/test_mail/tests/test_mail_followers.py +++ b/addons/test_mail/tests/test_mail_followers.py @@ -4,11 +4,9 @@ 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 @@ -119,7 +117,6 @@ 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 a70777b4f08..d9da245a1e0 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', 'post_install', '-at_install') +@tagged('mail_gateway') 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', 'post_install', '-at_install') +@tagged('mail_gateway') 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', 'post_install', '-at_install') +@tagged('mail_gateway') class TestMailgateway(TestMailCommon): @classmethod @@ -737,7 +737,6 @@ 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 a65a3c1b3fa..7e6b0f98ba2 100644 --- a/addons/test_mail/tests/test_mail_mail.py +++ b/addons/test_mail/tests/test_mail_mail.py @@ -6,11 +6,10 @@ 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, tagged +from odoo.tests import common from odoo.tools import mute_logger -@tagged('post_install', '-at_install') class TestMailMail(TestMailCommon): @mute_logger('odoo.addons.mail.models.mail_mail') @@ -37,7 +36,6 @@ 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 5ce9ffa0469..2ff5c6f7d5f 100644 --- a/addons/test_mail/tests/test_mail_message.py +++ b/addons/test_mail/tests/test_mail_message.py @@ -6,11 +6,10 @@ 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.tests import tagged from odoo.tools import mute_logger, formataddr +from odoo.tests import tagged -@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 de323fed812..a845ffc0a79 100644 --- a/addons/test_mail/tests/test_mail_template.py +++ b/addons/test_mail/tests/test_mail_template.py @@ -4,11 +4,9 @@ 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 1ff2ea4cab4..e94b5a533c3 100644 --- a/addons/test_mail/tests/test_message_composer.py +++ b/addons/test_mail/tests/test_message_composer.py @@ -7,11 +7,9 @@ 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 @@ -155,7 +153,6 @@ 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 02e95798514..b2c437ce2db 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', 'post_install', '-at_install') +@tagged('mail_wizards') 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 5b99717caa8..8e0a06320fb 100644 --- a/addons/test_mail/tests/test_message_post.py +++ b/addons/test_mail/tests/test_message_post.py @@ -9,11 +9,9 @@ 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 df260ee3b65..61d64a70abe 100644 --- a/addons/test_mail/tests/test_message_track.py +++ b/addons/test_mail/tests/test_message_track.py @@ -4,10 +4,8 @@ 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 67b0e499ff0..740a0444974 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", 'post_install', '-at_install') +@tagged("odoobot") class TestOdoobot(TestMailCommon, TestRecipients): @classmethod diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index 9e04c4b02c8..6cdc637ccf3 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 users, warmup +from odoo.tests.common import TransactionCase, users, warmup from odoo.tests import tagged from odoo.tools import mute_logger, formataddr -@tagged('mail_performance', 'post_install', '-at_install') +@tagged('mail_performance') class BaseMailPerformance(TransactionCaseWithUserDemo): def setUp(self): @@ -32,7 +32,7 @@ class BaseMailPerformance(TransactionCaseWithUserDemo): self.patch(self.env.registry, 'ready', True) -@tagged('mail_performance', 'post_install', '-at_install') +@tagged('mail_performance') class TestMailPerformance(BaseMailPerformance): def setUp(self): @@ -167,7 +167,7 @@ class TestMailPerformance(BaseMailPerformance): }) -@tagged('mail_performance', 'post_install', '-at_install') +@tagged('mail_performance') 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 - 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 + category = activity.activity_type_id.category - with self.assertQueryCount(__system__=19 + 1, emp=22 + 1): + with self.assertQueryCount(__system__=19, emp=22): 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 - 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 + category = activity.activity_type_id.category record.write({'name': 'Dupe write'}) - with self.assertQueryCount(__system__=20 + 1, emp=22 + 1): + with self.assertQueryCount(__system__=20, emp=22): 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 + 1, emp=44 + 1): + with self.assertQueryCount(__system__=38, emp=44): 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__=21 + 12, emp=21 + 12): + with self.assertQueryCount(__system__=28, emp=28): 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 + 1, emp=51 + 1): + with self.assertQueryCount(__system__=46, emp=51): 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 + 2, emp=41 + 2): + with self.assertQueryCount(__system__=40, emp=41): 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 + 1, emp=29 + 1): + with self.assertQueryCount(__system__=27, emp=29): 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 + 1, emp=34 + 1): + with self.assertQueryCount(__system__=33, emp=34): 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', 'post_install', '-at_install') +@tagged('mail_performance') 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 + 1, emp=74 + 1): + with self.assertQueryCount(__system__=73, emp=74): 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 + 3, emp=85 + 3): + with self.assertQueryCount(__system__=84, emp=85): 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 + 2, emp=40 + 2): + with self.assertQueryCount(__system__=39, emp=40): 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 + 3, emp=124 + 3): + with self.assertQueryCount(__system__=123, emp=124): 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 + 1, emp=88 + 1): + with self.assertQueryCount(__system__=87, emp=88): 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,12 +646,13 @@ 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 + 1, emp=96 + 1): + with self.assertQueryCount(__system__=95, emp=96): 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 @@ -679,7 +680,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 + 1, emp=35 + 1): + with self.assertQueryCount(__system__=34, emp=35): rec.write({ 'name': 'Test2', 'customer_id': customer_id, @@ -698,7 +699,7 @@ class TestMailComplexPerformance(BaseMailPerformance): self.assertEqual(len(rec1.message_ids), 3) -@tagged('mail_performance', 'post_install', '-at_install') +@tagged('mail_performance') class TestMailHeavyPerformancePost(BaseMailPerformance): def setUp(self): @@ -816,7 +817,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 + 17): + with self.assertQueryCount(emp=92): self.cr.sql_log = self.warm and self.cr.sql_log_count record.with_context({}).message_post( body='Test body