Use except x as y instead of except x, y
According to https://docs.python.org/3/howto/pyporting.html the syntax changed in Python 3.x. The new syntax is usable with Python >= 2.6 and should be preferred to be compatible with Python3. Enabled hacking check H231. Change-Id: I2c41dc3ec83e79181e8fd50e76771a74c393269c
This commit is contained in:
parent
0af4f035e2
commit
f6ff06b678
@ -543,7 +543,7 @@ class TestReaper(unittest.TestCase):
|
||||
with patch('swift.account.reaper.random.random', fake_random):
|
||||
try:
|
||||
r.run_forever()
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
pass
|
||||
self.assertEqual(self.val, 1)
|
||||
self.assertEqual(str(err), 'exit')
|
||||
|
@ -79,7 +79,7 @@ class TestCliInfoBase(unittest.TestCase):
|
||||
def assertRaisesMessage(self, exc, msg, func, *args, **kwargs):
|
||||
try:
|
||||
func(*args, **kwargs)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.assertTrue(msg in str(e),
|
||||
"Expected %r in %r" % (msg, str(e)))
|
||||
self.assertTrue(isinstance(e, exc),
|
||||
|
Loading…
x
Reference in New Issue
Block a user