14
0
2024-10-28 21:56:27 +00:00
committed by Git OBS Bridge
parent ea9da937ae
commit 16e3753760
3 changed files with 59 additions and 1 deletions

52
py313-tests.patch Normal file
View File

@@ -0,0 +1,52 @@
From 3b9aa7cf9f3b000407dc0ee8e77fbcf54fa04d7f Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Wed, 24 Apr 2024 09:56:08 +0200
Subject: [PATCH] Fix tests with Python 3.13
The textual representation of addresses has changed, adapt the code to
expect different values on Python 3.13+.
See: https://github.com/python/cpython/commit/f22bf8e3cf899896cf587099d292
---
tests/test_ipaddress.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/test_ipaddress.py b/tests/test_ipaddress.py
index 4a2339ef9..3f8036900 100755
--- a/tests/test_ipaddress.py
+++ b/tests/test_ipaddress.py
@@ -18,6 +18,7 @@
from . import testutils
import unittest
+import sys
import psycopg2
import psycopg2.extras
@@ -68,7 +69,12 @@ def test_inet_adapt(self):
self.assertEquals(cur.fetchone()[0], '127.0.0.1/24')
cur.execute("select %s", [ip.ip_interface('::ffff:102:300/128')])
- self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
+
+ # The texual representation of addresses has changed in Python 3.13
+ if sys.version_info >= (3, 13):
+ self.assertEquals(cur.fetchone()[0], '::ffff:1.2.3.0/128')
+ else:
+ self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
@testutils.skip_if_crdb("cidr")
def test_cidr_cast(self):
@@ -109,7 +115,12 @@ def test_cidr_adapt(self):
self.assertEquals(cur.fetchone()[0], '127.0.0.0/24')
cur.execute("select %s", [ip.ip_network('::ffff:102:300/128')])
- self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
+
+ # The texual representation of addresses has changed in Python 3.13
+ if sys.version_info >= (3, 13):
+ self.assertEquals(cur.fetchone()[0], '::ffff:1.2.3.0/128')
+ else:
+ self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
def test_suite():

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Oct 28 21:56:17 UTC 2024 - Dirk Müller <dmueller@suse.com>
- add py313-tests.patch
-------------------------------------------------------------------
Wed Jan 3 10:10:03 UTC 2024 - Dirk Müller <dmueller@suse.com>

View File

@@ -24,6 +24,7 @@ Summary: Python-PostgreSQL Database Adapter
License: LGPL-3.0-or-later AND (LGPL-3.0-or-later OR ZPL-2.0) AND SUSE-GPL-2.0-with-openssl-exception
URL: https://www.psycopg.org/
Source: https://files.pythonhosted.org/packages/source/p/psycopg2/psycopg2-%{version}.tar.gz
Patch1: https://github.com/psycopg/psycopg2/commit/3b9aa7cf9f3b000407dc0ee8e77fbcf54fa04d7f.patch#/py313-tests.patch
BuildRequires: %{python_module devel >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
@@ -52,7 +53,7 @@ UPDATEs. psycopg2 also provide asychronous operations and support
for coroutine libraries.
%prep
%setup -q -n psycopg2-%{version}
%autosetup -p1 -n psycopg2-%{version}
%build
export CFLAGS="%{optflags} -fno-strict-aliasing"