[PATCH 3/5] tests: Use python3 and python2 compatible socket exception type