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')
'list_db' : True,
'timezone' : False, # to override the default TZ
'test-disable' : False,
- 'test-rollback' : True,
- 'test-continue' : False
+ 'test-commit' : False,
}
self.misc = {}
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
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']