tests: Use Python 2.6 "except E as ..." syntax