From f2de38b84a58ec9f5f38e270aaf793fc070ab65e Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 12 Apr 2023 12:12:11 +0000 Subject: [PATCH] [IMP] test_module_operations: make debugging easier - ensure `test_module_operations` exits with a non-zero status on failure, as the current makes it a lot less convenient to notice uninstall / reinstall errors (especially with lots of warnings crowding the logs) - allow uninstalling without reinstalling, so it's easier to inspect db state after uninstall X-original-commit: 712977faf9bf98d9087368ab4fe95f089a072601 Part-of: odoo/odoo#120261 --- odoo/tests/test_module_operations.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/odoo/tests/test_module_operations.py b/odoo/tests/test_module_operations.py index 839573a88a1..400adff17a6 100755 --- a/odoo/tests/test_module_operations.py +++ b/odoo/tests/test_module_operations.py @@ -70,6 +70,7 @@ def parse_args(): help="Comma-separated list of paths to directories containing extra Odoo modules") parser.add_argument("--uninstall", "-U", type=str, help="Comma-separated list of modules to uninstall/reinstall") + parser.add_argument("--no-reinstall", '-n', dest="reinstall", action='store_false', default=True) parser.add_argument("--standalone", type=str, help="Launch standalone scripts tagged with @standalone. Accepts a list of " "module names or tags separated by commas. 'all' will run all available scripts." @@ -121,8 +122,7 @@ def test_uninstall(args): for module_id, module_name in modules_todo: uninstall(args.database, module_id, module_name) - if module_name not in INSTALL_BLACKLIST: - install(args.database, module_id, module_name) + if args.reinstall and module_name not in INSTALL_BLACKLIST: def test_scripts(args): @@ -175,5 +175,6 @@ if __name__ == '__main__': test_scripts(args) else: test_full(args) - except Exception as e: - _logger.exception("An error occured during standalone tests: %s", e) + except Exception: + _logger.error("%s tests failed", "uninstall" if args.uninstall else "standalone" if args.standalone else "cycle") + raise