diff options
| author | Xavier Morel <xmo@odoo.com> | 2020-09-02 12:57:48 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2020-10-13 05:51:08 +0000 |
| commit | 536809662e542994451be793cd09e87adbf31776 (patch) | |
| tree | 73be2986b827b5bbd64cd45f77ff7ba9633df6f8 | |
| parent | 281edf192efcf5b3c6c045942f75620af9346501 (diff) | |
[FIX] core: make --test-file work with symlinked modules
While individual addons paths are normalised, module and resource
paths are not.
As a result, when symlinking modules into directories on the
addons path, the path of test modules is only half-normalized: it's
normalised up to the addon path (which likely did not need it in that
setup) but not above that.
This is an issue when using `--test-file`, because that path is fully
normalised, and so the path of the provided test file and that of the
corresponding test module will not match, leading to the tests
unexpectedly not getting run.
Normalize the test module's path before the comparison, using the same
routing used for --test-file.
closes odoo/odoo#59751
X-original-commit: 46ad887ad8262a58d96dcd2b57707df267ae723e
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
| -rw-r--r-- | odoo/service/server.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/service/server.py b/odoo/service/server.py index b7127783472..bd795bc14f5 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -1175,7 +1175,7 @@ def load_test_file_py(registry, test_file): for mod in [m for m in get_modules() if '/%s/' % m in test_file]: for mod_mod in loader.get_test_modules(mod): mod_path, _ = os.path.splitext(getattr(mod_mod, '__file__', '')) - if test_path == mod_path: + if test_path == config._normalize(mod_path): tests = loader.unwrap_suite( unittest.TestLoader().loadTestsFromModule(mod_mod)) suite = OdooSuite(tests) |
