[IMP] renamed server option --test-no-rollback to --test-commit, and dropped --test...
authorOlivier Dony <odo@openerp.com>
Wed, 19 May 2010 15:30:27 +0000 (17:30 +0200)
committerOlivier Dony <odo@openerp.com>
Wed, 19 May 2010 15:30:27 +0000 (17:30 +0200)
bzr revid: odo@openerp.com-20100519153027-trhfaluudgo4f59z

bin/addons/__init__.py
bin/tools/config.py

index 82761d6..e0073d3 100644 (file)
@@ -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')
index a92948b..c18a742 100644 (file)
@@ -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']