aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/tests
diff options
context:
space:
mode:
authorGravatar Leifur Halldor Asgeirsson <lasgeirsson@zerofail.com>2016-02-18 17:24:05 -0500
committerGravatar Leifur Halldor Asgeirsson <lasgeirsson@zerofail.com>2016-03-18 16:01:57 -0400
commit554c7dd22f5be8abf8cd447270cec2a1e754631c (patch)
treef607838f2730ae12a09135f1b3e213a73a62ebe3 /src/python/grpcio/tests
parent4302be789d89703d48f033c44720f828765f1467 (diff)
py3 compatibility for test runner & loader
Diffstat (limited to 'src/python/grpcio/tests')
-rw-r--r--src/python/grpcio/tests/__init__.py4
-rw-r--r--src/python/grpcio/tests/_loader.py4
-rw-r--r--src/python/grpcio/tests/_result.py8
-rw-r--r--src/python/grpcio/tests/_runner.py7
4 files changed, 16 insertions, 7 deletions
diff --git a/src/python/grpcio/tests/__init__.py b/src/python/grpcio/tests/__init__.py
index b76b3985a1..c3b80d766d 100644
--- a/src/python/grpcio/tests/__init__.py
+++ b/src/python/grpcio/tests/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,6 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import absolute_import
+
from tests import _loader
from tests import _runner
diff --git a/src/python/grpcio/tests/_loader.py b/src/python/grpcio/tests/_loader.py
index 6992029b5e..2f9e5c660e 100644
--- a/src/python/grpcio/tests/_loader.py
+++ b/src/python/grpcio/tests/_loader.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,6 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import absolute_import
+
import importlib
import pkgutil
import re
diff --git a/src/python/grpcio/tests/_result.py b/src/python/grpcio/tests/_result.py
index 0670be921f..065153f0c3 100644
--- a/src/python/grpcio/tests/_result.py
+++ b/src/python/grpcio/tests/_result.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import cStringIO as StringIO
+from __future__ import absolute_import
+
import collections
import itertools
import traceback
@@ -35,6 +36,7 @@ import unittest
from xml.etree import ElementTree
import coverage
+from six import moves
from tests import _loader
@@ -356,7 +358,7 @@ def _traceback_string(type, value, trace):
Returns:
str: Formatted exception descriptive string.
"""
- buffer = StringIO.StringIO()
+ buffer = moves.cStringIO()
traceback.print_exception(type, value, trace, file=buffer)
return buffer.getvalue()
diff --git a/src/python/grpcio/tests/_runner.py b/src/python/grpcio/tests/_runner.py
index 3b5ca03dd9..e899154b0b 100644
--- a/src/python/grpcio/tests/_runner.py
+++ b/src/python/grpcio/tests/_runner.py
@@ -27,7 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import cStringIO as StringIO
+from __future__ import absolute_import
+
import collections
import fcntl
import multiprocessing
@@ -41,6 +42,8 @@ import time
import unittest
import uuid
+from six import moves
+
from tests import _loader
from tests import _result
@@ -143,7 +146,7 @@ class Runner(object):
for case in filtered_cases]
case_id_by_case = dict((augmented_case.case, augmented_case.id)
for augmented_case in augmented_cases)
- result_out = StringIO.StringIO()
+ result_out = moves.cStringIO()
result = _result.TerminalResult(
result_out, id_map=lambda case: case_id_by_case[case])
stdout_pipe = CaptureFile(sys.stdout.fileno())