remove more Python2 compatibility
diff --git a/test/crossrunner/compat.py b/test/crossrunner/compat.py
index 932a48c..a670c33 100644
--- a/test/crossrunner/compat.py
+++ b/test/crossrunner/compat.py
@@ -1,24 +1,7 @@
import os
-import sys
-if sys.version_info[0] == 2:
- _ENCODE = sys.getfilesystemencoding()
+path_join = os.path.join
+str_join = str.join
- def path_join(*args):
- bin_args = map(lambda a: a.decode(_ENCODE), args)
- return os.path.join(*bin_args).encode(_ENCODE)
-
- def str_join(left, right):
- bin_args = map(lambda a: a.decode(_ENCODE), right)
- b = left.decode(_ENCODE)
- return b.join(bin_args).encode(_ENCODE)
-
- logfile_open = open
-
-else:
-
- path_join = os.path.join
- str_join = str.join
-
- def logfile_open(*args):
- return open(*args, errors='replace')
+def logfile_open(*args):
+ return open(*args, errors='replace')
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index 5baf161..7e1b0c7 100644
--- a/test/crossrunner/report.py
+++ b/test/crossrunner/report.py
@@ -17,7 +17,6 @@
# under the License.
#
-from __future__ import print_function
import datetime
import json
import multiprocessing
@@ -317,10 +316,7 @@
self._print_bar()
def _http_server_command(self, port):
- if sys.version_info[0] < 3:
- return 'python -m SimpleHTTPServer %d' % port
- else:
- return 'python -m http.server %d' % port
+ return 'python -m http.server %d' % port
def _print_footer(self):
fail_count = len(self._expected_failure) + len(self._unexpected_failure)
diff --git a/test/py/FastbinaryTest.py b/test/py/FastbinaryTest.py
index 05c0bb6..f680357 100755
--- a/test/py/FastbinaryTest.py
+++ b/test/py/FastbinaryTest.py
@@ -25,8 +25,6 @@
# TODO(dreiss): Test error cases. Check for memory leaks.
-from __future__ import print_function
-
import math
import os
import sys
@@ -68,15 +66,11 @@
ooe2.integer64 = 64
ooe2.double_precision = (math.sqrt(5) + 1) / 2
ooe2.some_characters = ":R (me going \"rrrr\")"
-ooe2.zomg_unicode = u"\xd3\x80\xe2\x85\xae\xce\x9d\x20"\
- u"\xd0\x9d\xce\xbf\xe2\x85\xbf\xd0\xbe"\
- u"\xc9\xa1\xd0\xb3\xd0\xb0\xcf\x81\xe2\x84\x8e"\
- u"\x20\xce\x91\x74\x74\xce\xb1\xe2\x85\xbd\xce\xba"\
- u"\xc7\x83\xe2\x80\xbc"
-
-if sys.version_info[0] == 2 and os.environ.get('THRIFT_TEST_PY_NO_UTF8STRINGS'):
- ooe1.zomg_unicode = ooe1.zomg_unicode.encode('utf8')
- ooe2.zomg_unicode = ooe2.zomg_unicode.encode('utf8')
+ooe2.zomg_unicode = "\xd3\x80\xe2\x85\xae\xce\x9d\x20"\
+ "\xd0\x9d\xce\xbf\xe2\x85\xbf\xd0\xbe"\
+ "\xc9\xa1\xd0\xb3\xd0\xb0\xcf\x81\xe2\x84\x8e"\
+ "\x20\xce\x91\x74\x74\xce\xb1\xe2\x85\xbd\xce\xba"\
+ "\xc7\x83\xe2\x80\xbc"
hm = HolyMoley(**{"big": [], "contain": set(), "bonks": {}})
hm.big.append(ooe1)
@@ -86,10 +80,7 @@
hm.contain.add(("and a one", "and a two"))
hm.contain.add(("then a one, two", "three!", "FOUR!"))
-if sys.version_info[0] == 2 and os.environ.get('THRIFT_TEST_PY_NO_UTF8STRINGS'):
- hm.contain.add((u"\xd7\n\a\t".encode('utf8'),))
-else:
- hm.contain.add((u"\xd7\n\a\t",))
+hm.contain.add(("\xd7\n\a\t",))
hm.contain.add(())
hm.bonks["nothing"] = []
diff --git a/test/py/RunClientServer.py b/test/py/RunClientServer.py
index 583d88a..f48224f 100755
--- a/test/py/RunClientServer.py
+++ b/test/py/RunClientServer.py
@@ -19,8 +19,6 @@
# under the License.
#
-from __future__ import division
-from __future__ import print_function
import platform
import copy
import os
diff --git a/test/py/SerializationTest.py b/test/py/SerializationTest.py
index f47c3d4..218f26c 100755
--- a/test/py/SerializationTest.py
+++ b/test/py/SerializationTest.py
@@ -278,9 +278,6 @@
self.assertTrue(len(rep) > 0)
def testIntegerLimits(self):
- if (sys.version_info[0] == 2 and sys.version_info[1] <= 6):
- print('Skipping testIntegerLimits for Python 2.6')
- return
bad_values = [CompactProtoTestStruct(a_byte=128), CompactProtoTestStruct(a_byte=-129),
CompactProtoTestStruct(a_i16=32768), CompactProtoTestStruct(a_i16=-32769),
CompactProtoTestStruct(a_i32=2147483648), CompactProtoTestStruct(a_i32=-2147483649),
diff --git a/test/py/TestClient.py b/test/py/TestClient.py
index 61a9c60..d80ddf4 100755
--- a/test/py/TestClient.py
+++ b/test/py/TestClient.py
@@ -106,9 +106,6 @@
Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük,
Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文,
Bân-lâm-gú, 粵語"""
- if sys.version_info[0] == 2 and os.environ.get('THRIFT_TEST_PY_NO_UTF8STRINGS'):
- s1 = s1.encode('utf8')
- s2 = s2.encode('utf8')
self.assertEqual(self.client.testString(s1), s1)
self.assertEqual(self.client.testString(s2), s2)
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index 81ae1ad..e062378 100755
--- a/test/py/TestServer.py
+++ b/test/py/TestServer.py
@@ -18,7 +18,6 @@
# specific language governing permissions and limitations
# under the License.
#
-from __future__ import division
import logging
import os
import signal
diff --git a/test/test.py b/test/test.py
index cd5c4d4..a288c26 100755
--- a/test/test.py
+++ b/test/test.py
@@ -27,7 +27,6 @@
# subprocess management that are needed for reliability.
#
-from __future__ import print_function
from itertools import chain
import json
import logging