Support Python 3.7 (#1579761)

Add upstream commit to fix one test, remove the file of skipped test.
This commit is contained in:
Miro Hrončok 2018-05-18 12:31:58 +02:00
parent 0d28ee3b83
commit 89f4b65570
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,24 @@
From ef64493b8913e4069c4422ad14da6de405c445f6 Mon Sep 17 00:00:00 2001
From: Jon Dufresne <jon.dufresne@gmail.com>
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)

View File

@ -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