args for test
bzr revid: fp@tinyerp.com-20100704134937-w4jlfqya638trpi2
This commit is contained in:
parent
b9f86b3de2
commit
0568cbe53c
|
@ -113,8 +113,15 @@ if not ( tools.config["stop_after_init"] or \
|
|||
service.netrpc_server.init_servers()
|
||||
|
||||
if tools.config['db_name']:
|
||||
for db in tools.config['db_name'].split(','):
|
||||
pooler.get_db_and_pool(db, update_module=tools.config['init'] or tools.config['update'])
|
||||
for dbname in tools.config['db_name'].split(','):
|
||||
db,pool = pooler.get_db_and_pool(dbname, update_module=tools.config['init'] or tools.config['update'], pooljobs=False)
|
||||
if tools.config["test-file"]:
|
||||
logger.notifyChannel("init", netsvc.LOG_INFO,
|
||||
'loading test file %s' % (tools.config["test-file"],))
|
||||
cr = db.cursor()
|
||||
tools.convert_yaml_import(cr, 'base', file(tools.config["test-file"]), {}, 'test', True)
|
||||
cr.rollback()
|
||||
pool.get('ir.cron')._poolJobs(db.dbname)
|
||||
|
||||
#----------------------------------------------------------
|
||||
# translation stuff
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
pool_dic = {}
|
||||
|
||||
def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False):
|
||||
def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False, pooljobs=True):
|
||||
if not status:
|
||||
status={}
|
||||
|
||||
|
@ -50,7 +50,8 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False)
|
|||
|
||||
import report
|
||||
report.interface.register_all(db)
|
||||
pool.get('ir.cron')._poolJobs(db.dbname)
|
||||
if pooljobs:
|
||||
pool.get('ir.cron')._poolJobs(db.dbname)
|
||||
return db, pool
|
||||
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ class configmanager(object):
|
|||
'login_message': False,
|
||||
'list_db' : True,
|
||||
'timezone' : False, # to override the default TZ
|
||||
'test-file' : False,
|
||||
'test-disable' : False,
|
||||
'test-commit' : False,
|
||||
}
|
||||
|
@ -143,6 +144,7 @@ class configmanager(object):
|
|||
|
||||
# Testing Group
|
||||
group = optparse.OptionGroup(parser, "Testing Configuration")
|
||||
group.add_option("--test-file", dest="test_file", help="Launch a YML test file.")
|
||||
group.add_option("--test-disable", action="store_true", dest="test_disable",
|
||||
default=False, help="Disable loading test files.")
|
||||
group.add_option("--test-commit", action="store_true", dest="test_commit",
|
||||
|
@ -293,6 +295,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-file"] = opt.test_file
|
||||
self.options["test-disable"] = opt.test_disable
|
||||
self.options["test-commit"] = opt.test_commit
|
||||
self.options['update'] = opt.update and dict.fromkeys(opt.update.split(','), 1) or {}
|
||||
|
@ -468,5 +471,3 @@ config = configmanager()
|
|||
# other python executables without parsing *their* args.
|
||||
config.parse_config()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
Loading…
Reference in New Issue