tests: Make tests Python 2.6 compatible, avoid using assertRaises as context manager