Test framework: StringIO fixes for Python3