Fix KeyError when test_servers_get fails.

Updates the integrated.test_api_samples.ServersSampleAllExtensionXmlTest
test_servers_get function so that it doesn't try to list the line number
when the test fails.

Fixes a KeyError: '\'i\' exceptions.

Partial fix for LP Bug #1042709.

Change-Id: I666d18c1d4585cebce4534b1f16cd327850e8cdc
This commit is contained in:
Dan Prince 2012-08-28 10:09:05 -04:00
parent 458ee2eac0
commit f3c594a9b8
1 changed files with 2 additions and 2 deletions

View File

@ -100,10 +100,10 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
try:
match = re.match(line, result_line)
except Exception as exc:
self.fail(_('Response error on line %(i)s:\n'
self.fail(_('Response error on line:\n'
'%(line)s\n%(result_line)s') % locals())
if not match:
self.fail(_('Response error on line %(i)s:\n'
self.fail(_('Response error on line:\n'
'%(line)s\n%(result_line)s') % locals())
if match.groups():
result = match.groups()[0]