From a5658ecf6b39326c6d4a31463d63c3616005ca2f Mon Sep 17 00:00:00 2001 From: Florian da Costa <florian.dacosta@akretion.com> Date: Thu, 18 May 2023 11:46:08 +0200 Subject: [PATCH] [FIX] module_analysis : tests compatibility with pip install --- module_analysis/tests/test_module.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/module_analysis/tests/test_module.py b/module_analysis/tests/test_module.py index 20f96fc3f..d4f02f362 100644 --- a/module_analysis/tests/test_module.py +++ b/module_analysis/tests/test_module.py @@ -6,12 +6,18 @@ from odoo.tests.common import TransactionCase class TestModule(TransactionCase): - def setUp(self): - super().setUp() - self.IrModuleModule = self.env["ir.module.module"] + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.IrModuleModule = cls.env["ir.module.module"] + # Remove lib because it breaks tests in case of installation of modules with + # pip + cls.env["ir.config_parameter"].set_param( + "module_analysis.exclude_directories", "demo,test,tests,doc,description" + ) + cls.IrModuleModule.cron_analyse_code() def test_installed_modules(self): - self.IrModuleModule.cron_analyse_code() installed_modules = self.IrModuleModule.search( [("state", "=", "installed"), ("name", "not like", "_test")] )