From 2e0eaaef2baf1280b6c6ccdbc74b66f171181a40 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 3 Dec 2017 14:21:59 -0800 Subject: [PATCH 1/2] Fix use of "async" in test_cursor.py "async" will be a keyword starting with Python 3.7. On Python 3.6, use of "async" causes a deprecation warning. Use the alias "async_" instead. --- tests/test_cursor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cursor.py b/tests/test_cursor.py index e896ef94..5c94f422 100755 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -553,7 +553,7 @@ class CursorTests(ConnectingTestCase): # Issue #443 is in the async code too. Since the fix is duplicated, # so is the test. control_conn = self.conn - connect_func = lambda: self.connect(async=True) + connect_func = lambda: self.connect(async_=True) wait_func = psycopg2.extras.wait_select self._test_external_close(control_conn, connect_func, wait_func) From c85d190f26f2e74fea52410a28f70e88348a9b2b Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 3 Dec 2017 14:13:08 -0800 Subject: [PATCH 2/2] Fix definition of BUILD_DIR in Makefile The Python's platform should be included in the build dir. Was previously missing resulting in the incorrect path. Fixing the build dir allows testing psycopg2 without first calling "python setup.py install". Exposed a missing use of the deprecated "async" keyword. For additional information on how to calculate the build dir, see the following SO post: https://stackoverflow.com/a/14369968 --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a8f491e4..57cf841e 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,9 @@ # make check # this requires setting up a test database with the correct user PYTHON := python$(PYTHON_VERSION) -PYTHON_VERSION ?= $(shell $(PYTHON) -c 'import sys; print ("%d.%d" % sys.version_info[:2])') -BUILD_DIR = $(shell pwd)/build/lib.$(PYTHON_VERSION) +PYTHON_PLATFORM := $(shell $(PYTHON) -c 'import sysconfig; print(sysconfig.get_platform())') +PYTHON_VERSION ?= $(shell $(PYTHON) -c 'import sys; print("%d.%d" % sys.version_info[:2])') +BUILD_DIR = $(shell pwd)/build/lib.$(PYTHON_PLATFORM)-$(PYTHON_VERSION) SOURCE_C := $(wildcard psycopg/*.c psycopg/*.h) SOURCE_PY := $(wildcard lib/*.py)