[FIX] restore testing after patching runbot

bzr revid: al@openerp.com-20140209141912-rh3yedrmjudv8jif
This commit is contained in:
Antony Lesuisse 2014-02-09 15:19:12 +01:00
parent 87172d90d2
commit 16fd821ed6
1 changed files with 18 additions and 2 deletions

View File

@ -323,8 +323,24 @@ def adapt_version(version):
return version
def get_test_modules(module):
# backward compatibility for oe
return []
""" Return a list of module for the addons potentialy containing tests to
feed unittest2.TestLoader.loadTestsFromModule() """
# Try to import the module
module = 'openerp.addons.' + module + '.tests'
try:
m = __import__(module)
except Exception, e:
# If module has no `tests` sub-module, no problem.
if str(e) != 'No module named tests':
_logger.exception('Can not `import %s`.', module)
return []
# include submodules too
result = []
for name in sys.modules:
if name.startswith(module) and sys.modules[name]:
result.append(sys.modules[name])
return result
# Use a custom stream object to log the test executions.
class TestStream(object):