summaryrefslogtreecommitdiff
path: root/tests/testutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testutils.py')
-rw-r--r--tests/testutils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/testutils.py b/tests/testutils.py
index e1744c8..d70e091 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -31,6 +31,23 @@ import unittest
from functools import wraps
from .testconfig import dsn, repl_dsn
+# Python 2/3 compatibility
+
+if sys.version_info[0] == 2:
+ # Python 2
+ from StringIO import StringIO
+ long = long
+ reload = reload
+ unichr = unichr
+ unicode = unicode
+else:
+ # Python 3
+ from io import StringIO
+ from importlib import reload
+ long = int
+ unichr = chr
+ unicode = str
+
# Silence warnings caused by the stubbornness of the Python unittest
# maintainers