Fix Python 3 compatibility issues in the main runner.

All unit tests now pass on Python 2 and Python 3.
3 files changed