[FIX] ir.http testing generate a router including the current module

this fix is a dirty hack, the proper fix could be a new 'installing' state in
modules, or an improved registry object.

bzr revid: al@openerp.com-20140217005137-mhrzc4znr8rqe9yu
This commit is contained in:
Antony Lesuisse 2014-02-17 01:51:37 +01:00
parent e54758988a
commit 91b1c8472f
2 changed files with 7 additions and 0 deletions

View File

@ -135,6 +135,8 @@ class ir_http(osv.AbstractModel):
m = request.registry.get('ir.module.module')
ids = m.search(cr, openerp.SUPERUSER_ID, [('state', '=', 'installed'), ('name', '!=', 'web')], context=request.context)
installed = set(x['name'] for x in m.read(cr, 1, ids, ['name'], context=request.context))
if openerp.tools.config['test_enable']:
installed.add(openerp.modules.module.current_test)
mods = [''] + openerp.conf.server_wide_modules + sorted(installed)
self._routing_map = http.routing_map(mods, False, converters=self._get_converters())

View File

@ -352,11 +352,15 @@ class TestStream(object):
first = False
_test_logger.info(c)
current_test = None
def run_unit_tests(module_name, dbname):
"""
Return True or False if some tests were found and succeeded or failed.
Return None if no test was found.
"""
global current_test
current_test = module_name
mods = get_test_modules(module_name)
r = True
for m in mods:
@ -368,6 +372,7 @@ def run_unit_tests(module_name, dbname):
if not result.wasSuccessful():
r = False
_logger.error('module %s: at least one error occurred in a test', module_name)
current_test = None
return r
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: