Fix py3 compatibility issues in tests.