diff --git a/psycopg2-test-cursor-async.patch b/psycopg2-test-cursor-async.patch new file mode 100644 index 0000000..539e4d0 --- /dev/null +++ b/psycopg2-test-cursor-async.patch @@ -0,0 +1,24 @@ +From ef64493b8913e4069c4422ad14da6de405c445f6 Mon Sep 17 00:00:00 2001 +From: Jon Dufresne +Date: Sun, 3 Dec 2017 18:47:19 -0800 +Subject: [PATCH] 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 @@ def test_external_close_async(self): + # 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) + diff --git a/python-psycopg2.spec b/python-psycopg2.spec index 0ef28e0..701aebc 100644 --- a/python-psycopg2.spec +++ b/python-psycopg2.spec @@ -39,6 +39,9 @@ Url: http://www.psycopg.org/psycopg/ Source0: http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-7/psycopg2-%{version}.tar.gz +# https://github.com/psycopg/psycopg2/commit/ef64493b8913e4069c4422ad14da6de405c445f6 +Patch0: %{srcname}-test-cursor-async.patch + %{?with_python2:BuildRequires: python2-debug python2-devel} %{?with_python3:BuildRequires: python3-debug python3-devel} @@ -140,6 +143,7 @@ Zope Database Adapter for PostgreSQL, called ZPsycopgDA %prep %setup -q -n psycopg2-%{version} +%patch0 -p1 %build @@ -189,6 +193,8 @@ install -d %{buildroot}%{ZPsycopgDAdir} cp -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir} %endif +# This test is skipped on 3.7 and has a syntax error so brp-python-bytecompile would choke on it +%{?with_python3:rm -rf %{buildroot}%{python3_sitearch}/%{srcname}/tests/test_async_keyword.py} %if %{with python2} %files -n python2-psycopg2