port: add an assertRaises function returning a context manager

The ability to return context managers from
unittest.TestCase.assertRaises got added in Python 2.7 and we still
support Python 2.6.