summaryrefslogtreecommitdiff
path: root/tests/dbapi20.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-12-03 18:47:19 -0800
committerJon Dufresne <jon.dufresne@gmail.com>2017-12-10 10:51:07 -0800
commit1a8e992fcc87b2d15911b60cc9220ec50a70a4ff (patch)
treeb24d491d6ecff95cfbee78409a037a49f182b744 /tests/dbapi20.py
parent9de46e416e5ac1be1c5ff170d1c1ada5b8d7278f (diff)
downloadpsycopg2-1a8e992fcc87b2d15911b60cc9220ec50a70a4ff.tar.gz
Use relative imports throughout tests
The tests relied on Python2 relative import semantics. Python3 changed import semantics to always search sys.path by default. To import using a relative path it must have a leading dot. Forward compatible with newer Pythons. Works towards the goal of moving tests outside of the installed package. For more information, see PEP-328: https://www.python.org/dev/peps/pep-0328/
Diffstat (limited to 'tests/dbapi20.py')
-rw-r--r--tests/dbapi20.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/dbapi20.py b/tests/dbapi20.py
index 4facf8e..212d054 100644
--- a/tests/dbapi20.py
+++ b/tests/dbapi20.py
@@ -90,12 +90,12 @@ class DatabaseAPI20Test(unittest.TestCase):
self.driver, connect_args and connect_kw_args. Class specification
should be as follows:
- import dbapi20
+ from . import dbapi20
class mytest(dbapi20.DatabaseAPI20Test):
[...]
- Don't 'import DatabaseAPI20Test from dbapi20', or you will
- confuse the unit tester - just 'import dbapi20'.
+ Don't 'from .dbapi20 import DatabaseAPI20Test', or you will
+ confuse the unit tester - just 'from . import dbapi20'.
'''
# The self.driver module. This should be the module where the 'connect'