From 73b5ab1b242cdc8371cf7e95995c148bbe1add7f Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 19 May 2010 17:30:27 +0200 Subject: [PATCH] [IMP] renamed server option --test-no-rollback to --test-commit, and dropped --test-continue, making it the default bzr revid: odo@openerp.com-20100519153027-trhfaluudgo4f59z --- bin/addons/__init__.py | 13 +++++-------- bin/tools/config.py | 12 ++++-------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 82761d647bd..e0073d3f123 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -644,16 +644,13 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): try: _load_data(cr, module_name, id_map, mode, 'test') except Exception, e: - if tools.config.options['test-continue']: - logger.notifyChannel('ERROR', netsvc.LOG_TEST, e) - pass - else: - raise + logger.notifyChannel('ERROR', netsvc.LOG_TEST, e) + pass finally: - if tools.config.options['test-rollback']: - cr.rollback() - else: + if tools.config.options['test-commit']: cr.commit() + else: + cr.rollback() def _load_data(cr, module_name, id_map, mode, kind): noupdate = (kind == 'demo') diff --git a/bin/tools/config.py b/bin/tools/config.py index a92948b8af0..c18a7422e2c 100644 --- a/bin/tools/config.py +++ b/bin/tools/config.py @@ -83,8 +83,7 @@ class configmanager(object): 'list_db' : True, 'timezone' : False, # to override the default TZ 'test-disable' : False, - 'test-rollback' : True, - 'test-continue' : False + 'test-commit' : False, } self.misc = {} @@ -142,10 +141,8 @@ class configmanager(object): group = optparse.OptionGroup(parser, "Testing Configuration") group.add_option("--test-disable", action="store_true", dest="test_disable", default=False, help="Disable loading test files.") - group.add_option("--test-no-rollback", action="store_false", dest="test_rollback", - default=True, help="Don't rollback after running test.") - group.add_option("--test-continue", action="store_true", dest="test_continue", - default=False, help="Display exception but then test should continue.") + group.add_option("--test-commit", action="store_true", dest="test_commit", + default=False, help="Commit database changes performed by tests.") parser.add_option_group(group) # Logging Group @@ -288,8 +285,7 @@ class configmanager(object): self.options['init'] = opt.init and dict.fromkeys(opt.init.split(','), 1) or {} self.options["demo"] = not opt.without_demo and self.options['init'] or {} self.options["test-disable"] = opt.test_disable - self.options["test-rollback"] = opt.test_rollback - self.options["test-continue"] = opt.test_continue + self.options["test-commit"] = opt.test_commit self.options['update'] = opt.update and dict.fromkeys(opt.update.split(','), 1) or {} self.options['translate_modules'] = opt.translate_modules and map(lambda m: m.strip(), opt.translate_modules.split(',')) or ['all']