don't stop if one db fails, run for all so we can tell how badly things went wrong on Hudson

This commit is contained in:
chrisw 2010-09-09 21:44:28 +01:00
parent 4d938a3baf
commit 514498d6be

View File

@ -76,29 +76,40 @@ def usedb(supported=None, not_supported=None):
@decorator @decorator
def dec(f, self, *a, **kw): def dec(f, self, *a, **kw):
failed_for = []
exception = None
for url in my_urls: for url in my_urls:
log.debug("Running test with engine %s", url)
try: try:
log.debug("Running test with engine %s", url)
try: try:
self._setup(url) try:
except Exception,e: self._setup(url)
setup_exception=e except Exception,e:
else: setup_exception=e
setup_exception=None else:
f(self, *a, **kw) setup_exception=None
finally: f(self, *a, **kw)
try: finally:
self._teardown() try:
except Exception,e: self._teardown()
teardown_exception=e except Exception,e:
else: teardown_exception=e
teardown_exception=None else:
if setup_exception or teardown_exception: teardown_exception=None
raise RuntimeError(( if setup_exception or teardown_exception:
'Exception during _setup/_teardown:\n' raise RuntimeError((
'setup: %r\n' 'Exception during _setup/_teardown:\n'
'teardown: %r\n' 'setup: %r\n'
)%(setup_exception,teardown_exception)) 'teardown: %r\n'
)%(setup_exception,teardown_exception))
except Exception,e:
failed_for.append(url)
exception = exception or e
for url in failed_for:
log.error('Failed for %s', url)
if exception:
# cause the failure :-)
raise exception
return dec return dec