Python2 compatibility for tests