diff --git a/addons/hr_org_chart/tests/test_employee_deletion.py b/addons/hr_org_chart/tests/test_employee_deletion.py index ba5fb329a8221b7d416bb4a6a65f9fc5e37032f1..be261fcfc82987a5faff11872c592e3eb1c5d821 100644 --- a/addons/hr_org_chart/tests/test_employee_deletion.py +++ b/addons/hr_org_chart/tests/test_employee_deletion.py @@ -4,7 +4,7 @@ from odoo.tests import Form, tagged, TransactionCase from odoo.exceptions import MissingError -@tagged('post_install') +@tagged('post_install', '-at_install') class TestEmployeeDeletion(TransactionCase): def test_employee_deletion(self): diff --git a/addons/sms/tests/test_sms_template.py b/addons/sms/tests/test_sms_template.py index 9483ecaf7bcf86460f75367b8bd9943c29fd9720..132916667f15de90b77c7e63a3d8edab3d5e8f0a 100644 --- a/addons/sms/tests/test_sms_template.py +++ b/addons/sms/tests/test_sms_template.py @@ -8,7 +8,7 @@ from odoo.tests import tagged from odoo.tools import mute_logger -@tagged('post_install') +@tagged('post_install', '-at_install') class TestSmsTemplateAccessRights(SavepointCase): @classmethod diff --git a/addons/survey/tests/test_survey_security.py b/addons/survey/tests/test_survey_security.py index 191e8edd711bcb03134183bea55120d7aaf6fae1..27f974301bec6cd70a747ffe66564ee8df63ea34 100644 --- a/addons/survey/tests/test_survey_security.py +++ b/addons/survey/tests/test_survey_security.py @@ -326,7 +326,7 @@ class TestAccess(common.TestSurveyCommon): (answer_own | answer_other | self.answer_0).unlink() -@tagged('post_install') +@tagged('post_install', '-at_install') class TestSurveySecurityControllers(common.TestSurveyCommon, HttpCase): def test_survey_start_short(self): # avoid name clash with existing data diff --git a/odoo/addons/base/tests/test_tests_tags.py b/odoo/addons/base/tests/test_tests_tags.py index 52856aadc83f9ec4d28f38c231e1b5e1a1db43e0..a823ee18ab268a97f6f6d009ea58f76c6b81224d 100644 --- a/odoo/addons/base/tests/test_tests_tags.py +++ b/odoo/addons/base/tests/test_tests_tags.py @@ -89,19 +89,19 @@ class TestSetTags(TransactionCase): self.assertEqual(fc.test_tags, {'at_install'}) self.assertEqual(fc.test_module, 'base') - @tagged('-standard', '-base', '-at_install') + @tagged('-standard', '-base', '-at_install', 'post_install') class FakeClassB(TransactionCase): pass fc = FakeClassB() - self.assertEqual(fc.test_tags, set()) + self.assertEqual(fc.test_tags, {'post_install'}) - @tagged('-standard', '-base', '-at_install', 'fast') + @tagged('-standard', '-base', 'fast') class FakeClassC(TransactionCase): pass fc = FakeClassC() - self.assertEqual(fc.test_tags, {'fast', }) + self.assertEqual(fc.test_tags, {'fast', 'at_install'}) @tagged('nodatabase') diff --git a/odoo/tests/common.py b/odoo/tests/common.py index b5addb4533c5d390984731b17afaff23ed9b350d..0717a2e65ebfc2e7feef1c2c77565e1c9e4e9e1d 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -2601,6 +2601,10 @@ def tagged(*tags): include = {t for t in tags if not t.startswith('-')} exclude = {t[1:] for t in tags if t.startswith('-')} obj.test_tags = (getattr(obj, 'test_tags', set()) | include) - exclude # todo remove getattr in master since we want to limmit tagged to BaseCase and always have +standard tag + at_install = 'at_install' in obj.test_tags + post_install = 'post_install' in obj.test_tags + if not (at_install ^ post_install): + _logger.warning('A tests should be either at_install or post_install, which is not the case of %r', obj) return obj return tags_decorator