summaryrefslogtreecommitdiff
path: root/odoo/addons/test_lint
diff options
context:
space:
mode:
authorChristophe Monniez <moc@odoo.com>2021-02-23 13:24:08 +0000
committerChristophe Monniez <moc@odoo.com>2021-02-23 13:52:54 +0000
commit506755ef8ced187c0f5cd2fa600e7bb1e1fc0fe3 (patch)
treef978b57be39b9429e607c1e207b698962683f5a0 /odoo/addons/test_lint
parent45e14adb2fbe9c61f0f529c33cc1ec3ad35114e1 (diff)
[FIX] tests: test support for modules without `__init__.py`
Now that a test exists to enforce `__init__.py` in odoo module, we must ensure that we keep the feature. For that reason, a white-list system is added in `test_dunderinit` and a test is added in order to be sure that a module without `__init__.py` can be exists. This this is made of a fake module `test_data_module` without `__init__.py` and a test module which ensure the fake module was installed. closes odoo/odoo#66651 Related: odoo/enterprise#16596 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Diffstat (limited to 'odoo/addons/test_lint')
-rw-r--r--odoo/addons/test_lint/tests/test_dunderinit.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/odoo/addons/test_lint/tests/test_dunderinit.py b/odoo/addons/test_lint/tests/test_dunderinit.py
index a074896832c..3a209258dd0 100644
--- a/odoo/addons/test_lint/tests/test_dunderinit.py
+++ b/odoo/addons/test_lint/tests/test_dunderinit.py
@@ -9,13 +9,15 @@ from . import lint_case
_logger = logging.getLogger(__name__)
+# whitelist that allow data modules only
+WHITELIST = ['test_data_module', ]
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()
+ modules_list = [mod for mod in get_modules() if mod not in WHITELIST]
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)