diff options
| author | Xavier-Do <xdo@odoo.com> | 2020-03-03 13:49:53 +0000 |
|---|---|---|
| committer | Xavier-Do <xdo@odoo.com> | 2020-03-05 17:30:22 +0000 |
| commit | 5ae6f02e45168ef95d65c1956cea8b90218d8941 (patch) | |
| tree | 4124fdb9e7ebd65ac9f7d987a1fdd2199cccfbbd | |
| parent | 32c8922432fd21ea01468ea05aa76fa1bb4c9890 (diff) | |
[IMP] tests: scan upgrade path for additionnal tests
A future upgrades improvement will be to add tests in upgrades
modules. This small imp will scan in upgrade for some tests,
specific tooling will be added to upgrade repository in odoo/upgrade#878
closes odoo/odoo#47030
X-original-commit: 59b5a03bdf7ae1ad8851a67d278edc31a26a96a8
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
| -rw-r--r-- | odoo/modules/module.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/odoo/modules/module.py b/odoo/modules/module.py index 191a45e9e8e..b5a513e19fc 100644 --- a/odoo/modules/module.py +++ b/odoo/modules/module.py @@ -357,7 +357,19 @@ def get_test_modules(module): """ Return a list of module for the addons potentially containing tests to feed unittest.TestLoader.loadTestsFromModule() """ # Try to import the module - modpath = 'odoo.addons.' + module + results = _get_tests_modules('odoo.addons', module) + + try: + importlib.import_module('odoo.upgrade.%s' % module) + except ImportError: + pass + else: + results += _get_tests_modules('odoo.upgrade', module) + + return results + +def _get_tests_modules(path, module): + modpath = '%s.%s' % (path, module) try: mod = importlib.import_module('.tests', modpath) except ImportError as e: # will also catch subclass ModuleNotFoundError of P3.6 |
