diff --git a/odoo/addons/test_lint/tests/__init__.py b/odoo/addons/test_lint/tests/__init__.py index c28bef7f10799cf72e255e5e6bfff8305ba2a56b..b8416fe62bfbc2f4ba31d2bca3b91976982d0e83 100644 --- a/odoo/addons/test_lint/tests/__init__.py +++ b/odoo/addons/test_lint/tests/__init__.py @@ -3,3 +3,4 @@ from . import test_pofile from . import test_ecmascript from . import test_markers from . import test_onchange_domains +from . import test_dunderinit diff --git a/odoo/addons/test_lint/tests/test_dunderinit.py b/odoo/addons/test_lint/tests/test_dunderinit.py new file mode 100644 index 0000000000000000000000000000000000000000..a074896832c5678ab778b910ce61d60bba7cad97 --- /dev/null +++ b/odoo/addons/test_lint/tests/test_dunderinit.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import logging +from pathlib import Path + +from odoo.modules import get_modules, get_module_path +from . import lint_case + +_logger = logging.getLogger(__name__) + + +class TestDunderinit(lint_case.LintCase): + + def test_dunderinit(self): + """ Test that __init__.py exists in Odoo modules, otherwise they won't get packaged""" + + modules_list = get_modules() + for mod in modules_list: + dunderinit_path = Path(get_module_path(mod)) / '__init__.py' + self.assertTrue(dunderinit_path.is_file(), "Missing `__init__.py ` in module %s" % mod) + + _logger.info('%s modules checked', len(modules_list))