Fix lint and py3 compat in tests