diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-03 18:47:19 -0800 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-10 10:55:58 -0800 |
commit | 389f6c08d9536060184bfd5c8ea2491a4a91c2fb (patch) | |
tree | f85e494ab9c681494616ec6bb9b9d01852c62f90 /tests/testutils.py | |
parent | c86e682153f4cb8d99e490b2af964f3f11e3489f (diff) | |
download | psycopg2-389f6c08d9536060184bfd5c8ea2491a4a91c2fb.tar.gz |
Avoid installing tests to site-packages
For library end users, there is no need to install tests alongside the
package itself. This keeps the tests available for development without
adding extra packages to user's site-packages directory. Reduces the
size of the installed package. Avoids accidental execution of test code
by an installed package.
Diffstat (limited to 'tests/testutils.py')
-rw-r--r-- | tests/testutils.py | 17 |
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 |