Sync from SUSE:SLFO:Main python-redis revision 65c846bccc616f9e93f36f03aa295c58
This commit is contained in:
parent
e4f5636f95
commit
aadf5fc29e
149
Close-various-objects-created-during-asyncio-tests.patch
Normal file
149
Close-various-objects-created-during-asyncio-tests.patch
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
From 29d867899ab7abfb0ec2ef73d5bd3a810f8ab432 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= <sweskman@gmail.com>
|
||||||
|
Date: Fri, 13 Oct 2023 15:54:23 +0000
|
||||||
|
Subject: [PATCH] Close various objects created during asyncio tests
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/test_asyncio/test_commands.py | 2 ++
|
||||||
|
tests/test_asyncio/test_connect.py | 2 ++
|
||||||
|
tests/test_asyncio/test_connection.py | 4 ++++
|
||||||
|
tests/test_asyncio/test_retry.py | 3 +++
|
||||||
|
tests/test_asyncio/test_sentinel.py | 22 +++++++++----------
|
||||||
|
.../test_sentinel_managed_connection.py | 1 +
|
||||||
|
6 files changed, 23 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_asyncio/test_commands.py b/tests/test_asyncio/test_commands.py
|
||||||
|
index 9b9852e9ef..35b9f2a29f 100644
|
||||||
|
--- a/tests/test_asyncio/test_commands.py
|
||||||
|
+++ b/tests/test_asyncio/test_commands.py
|
||||||
|
@@ -370,10 +370,12 @@ async def test_client_setinfo(self, r: redis.Redis):
|
||||||
|
info = await r2.client_info()
|
||||||
|
assert info["lib-name"] == "test2"
|
||||||
|
assert info["lib-ver"] == "1234"
|
||||||
|
+ await r2.aclose()
|
||||||
|
r3 = redis.asyncio.Redis(lib_name=None, lib_version=None)
|
||||||
|
info = await r3.client_info()
|
||||||
|
assert info["lib-name"] == ""
|
||||||
|
assert info["lib-ver"] == ""
|
||||||
|
+ await r3.aclose()
|
||||||
|
|
||||||
|
@skip_if_server_version_lt("2.6.9")
|
||||||
|
@pytest.mark.onlynoncluster
|
||||||
|
diff --git a/tests/test_asyncio/test_connect.py b/tests/test_asyncio/test_connect.py
|
||||||
|
index 0b2d7c2afa..5e6b120fb3 100644
|
||||||
|
--- a/tests/test_asyncio/test_connect.py
|
||||||
|
+++ b/tests/test_asyncio/test_connect.py
|
||||||
|
@@ -73,6 +73,8 @@ async def _handler(reader, writer):
|
||||||
|
try:
|
||||||
|
return await _redis_request_handler(reader, writer, stop_event)
|
||||||
|
finally:
|
||||||
|
+ writer.close()
|
||||||
|
+ await writer.wait_closed()
|
||||||
|
finished.set()
|
||||||
|
|
||||||
|
if isinstance(server_address, str):
|
||||||
|
diff --git a/tests/test_asyncio/test_connection.py b/tests/test_asyncio/test_connection.py
|
||||||
|
index 28e6b0d9c3..9c7f25bf87 100644
|
||||||
|
--- a/tests/test_asyncio/test_connection.py
|
||||||
|
+++ b/tests/test_asyncio/test_connection.py
|
||||||
|
@@ -85,6 +85,8 @@ async def get_conn(_):
|
||||||
|
|
||||||
|
assert init_call_count == 1
|
||||||
|
assert command_call_count == 2
|
||||||
|
+ r.connection = None # it was a Mock
|
||||||
|
+ await r.aclose()
|
||||||
|
|
||||||
|
|
||||||
|
@skip_if_server_version_lt("4.0.0")
|
||||||
|
@@ -143,6 +145,7 @@ async def mock_connect():
|
||||||
|
conn._connect.side_effect = mock_connect
|
||||||
|
await conn.connect()
|
||||||
|
assert conn._connect.call_count == 3
|
||||||
|
+ await conn.disconnect()
|
||||||
|
|
||||||
|
|
||||||
|
async def test_connect_without_retry_on_os_error():
|
||||||
|
@@ -194,6 +197,7 @@ async def test_connection_parse_response_resume(r: redis.Redis):
|
||||||
|
pytest.fail("didn't receive a response")
|
||||||
|
assert response
|
||||||
|
assert i > 0
|
||||||
|
+ await conn.disconnect()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.onlynoncluster
|
||||||
|
diff --git a/tests/test_asyncio/test_retry.py b/tests/test_asyncio/test_retry.py
|
||||||
|
index 2912ca786c..8bc71c1479 100644
|
||||||
|
--- a/tests/test_asyncio/test_retry.py
|
||||||
|
+++ b/tests/test_asyncio/test_retry.py
|
||||||
|
@@ -131,5 +131,8 @@ async def test_get_set_retry_object(self, request):
|
||||||
|
assert r.get_retry()._retries == new_retry_policy._retries
|
||||||
|
assert isinstance(r.get_retry()._backoff, ExponentialBackoff)
|
||||||
|
assert exiting_conn.retry._retries == new_retry_policy._retries
|
||||||
|
+ await r.connection_pool.release(exiting_conn)
|
||||||
|
new_conn = await r.connection_pool.get_connection("_")
|
||||||
|
assert new_conn.retry._retries == new_retry_policy._retries
|
||||||
|
+ await r.connection_pool.release(new_conn)
|
||||||
|
+ await r.aclose()
|
||||||
|
diff --git a/tests/test_asyncio/test_sentinel.py b/tests/test_asyncio/test_sentinel.py
|
||||||
|
index 25bd7730da..51e59d69d0 100644
|
||||||
|
--- a/tests/test_asyncio/test_sentinel.py
|
||||||
|
+++ b/tests/test_asyncio/test_sentinel.py
|
||||||
|
@@ -183,13 +183,13 @@ async def test_discover_slaves(cluster, sentinel):
|
||||||
|
|
||||||
|
@pytest.mark.onlynoncluster
|
||||||
|
async def test_master_for(cluster, sentinel, master_ip):
|
||||||
|
- master = sentinel.master_for("mymaster", db=9)
|
||||||
|
- assert await master.ping()
|
||||||
|
- assert master.connection_pool.master_address == (master_ip, 6379)
|
||||||
|
+ async with sentinel.master_for("mymaster", db=9) as master:
|
||||||
|
+ assert await master.ping()
|
||||||
|
+ assert master.connection_pool.master_address == (master_ip, 6379)
|
||||||
|
|
||||||
|
# Use internal connection check
|
||||||
|
- master = sentinel.master_for("mymaster", db=9, check_connection=True)
|
||||||
|
- assert await master.ping()
|
||||||
|
+ async with sentinel.master_for("mymaster", db=9, check_connection=True) as master:
|
||||||
|
+ assert await master.ping()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.onlynoncluster
|
||||||
|
@@ -197,16 +197,16 @@ async def test_slave_for(cluster, sentinel):
|
||||||
|
cluster.slaves = [
|
||||||
|
{"ip": "127.0.0.1", "port": 6379, "is_odown": False, "is_sdown": False}
|
||||||
|
]
|
||||||
|
- slave = sentinel.slave_for("mymaster", db=9)
|
||||||
|
- assert await slave.ping()
|
||||||
|
+ async with sentinel.slave_for("mymaster", db=9) as slave:
|
||||||
|
+ assert await slave.ping()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.onlynoncluster
|
||||||
|
async def test_slave_for_slave_not_found_error(cluster, sentinel):
|
||||||
|
cluster.master["is_odown"] = True
|
||||||
|
- slave = sentinel.slave_for("mymaster", db=9)
|
||||||
|
- with pytest.raises(SlaveNotFoundError):
|
||||||
|
- await slave.ping()
|
||||||
|
+ async with sentinel.slave_for("mymaster", db=9) as slave:
|
||||||
|
+ with pytest.raises(SlaveNotFoundError):
|
||||||
|
+ await slave.ping()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.onlynoncluster
|
||||||
|
@@ -260,7 +260,7 @@ async def mock_disconnect():
|
||||||
|
calls += 1
|
||||||
|
|
||||||
|
with mock.patch.object(pool, "disconnect", mock_disconnect):
|
||||||
|
- await client.close()
|
||||||
|
+ await client.aclose()
|
||||||
|
|
||||||
|
assert calls == 1
|
||||||
|
await pool.disconnect()
|
||||||
|
diff --git a/tests/test_asyncio/test_sentinel_managed_connection.py b/tests/test_asyncio/test_sentinel_managed_connection.py
|
||||||
|
index 711b3ee733..cae4b9581f 100644
|
||||||
|
--- a/tests/test_asyncio/test_sentinel_managed_connection.py
|
||||||
|
+++ b/tests/test_asyncio/test_sentinel_managed_connection.py
|
||||||
|
@@ -34,3 +34,4 @@ async def mock_connect():
|
||||||
|
conn._connect.side_effect = mock_connect
|
||||||
|
await conn.connect()
|
||||||
|
assert conn._connect.call_count == 3
|
||||||
|
+ await conn.disconnect()
|
23
increase-test-timeout.patch
Normal file
23
increase-test-timeout.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Index: redis-5.0.1/tests/test_asyncio/test_lock.py
|
||||||
|
===================================================================
|
||||||
|
--- redis-5.0.1.orig/tests/test_asyncio/test_lock.py
|
||||||
|
+++ redis-5.0.1/tests/test_asyncio/test_lock.py
|
||||||
|
@@ -107,7 +107,7 @@ class TestLock:
|
||||||
|
async def test_blocking_timeout(self, r, event_loop):
|
||||||
|
lock1 = self.get_lock(r, "foo")
|
||||||
|
assert await lock1.acquire(blocking=False)
|
||||||
|
- bt = 0.2
|
||||||
|
+ bt = 0.3
|
||||||
|
sleep = 0.05
|
||||||
|
lock2 = self.get_lock(r, "foo", sleep=sleep, blocking_timeout=bt)
|
||||||
|
start = event_loop.time()
|
||||||
|
Index: redis-5.0.1/pytest.ini
|
||||||
|
===================================================================
|
||||||
|
--- redis-5.0.1.orig/pytest.ini
|
||||||
|
+++ redis-5.0.1/pytest.ini
|
||||||
|
@@ -10,4 +10,4 @@ markers =
|
||||||
|
replica: replica tests
|
||||||
|
experimental: run only experimental tests
|
||||||
|
asyncio_mode = auto
|
||||||
|
-timeout = 30
|
||||||
|
+timeout = 40
|
@ -1,7 +1,24 @@
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Nov 15 08:36:51 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
Tue Mar 26 13:46:39 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
|
||||||
|
|
||||||
- Disable flaky tests for arches different from x86_64, bsc#1216606
|
- Switch build system from setuptools to pyproject.toml
|
||||||
|
+ Add python-pip and python-wheel to BuildRequires
|
||||||
|
+ Replace %python_build with %pyproject_wheel
|
||||||
|
+ Replace %python_install with %pyproject_install
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jan 15 20:19:45 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- add https://github.com/redis/redis-py/pull/3005 as
|
||||||
|
Close-various-objects-created-during-asyncio-tests.patch
|
||||||
|
to fix tests for python 3.12
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jan 2 11:21:25 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>
|
||||||
|
|
||||||
|
- Add patch to increase timeouts in s390x where tests take longer
|
||||||
|
to run:
|
||||||
|
* increase-test-timeout.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Oct 30 13:09:20 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
Mon Oct 30 13:09:20 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
@ -149,7 +166,7 @@ Tue Apr 18 03:37:06 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
|||||||
- Update to 4.5.4:
|
- Update to 4.5.4:
|
||||||
* Security
|
* Security
|
||||||
+ Cancelling an async future does not, properly trigger, leading to a
|
+ Cancelling an async future does not, properly trigger, leading to a
|
||||||
potential data leak in specific cases. (CVE-2023-28858, bsc#1209811)
|
potential data leak in specific cases. (CVE-2023-28858, bsc#1209811)
|
||||||
+ Cancelling an async future does not, properly trigger, leading to a
|
+ Cancelling an async future does not, properly trigger, leading to a
|
||||||
potential data leak in specific cases. (CVE-2023-28859, bsc#1209812)
|
potential data leak in specific cases. (CVE-2023-28859, bsc#1209812)
|
||||||
* New Features
|
* New Features
|
||||||
@ -1342,7 +1359,7 @@ Fri Apr 15 12:43:07 UTC 2011 - saschpe@suse.de
|
|||||||
now be useable on 2.4, but this hasn't actually been tested. Thanks
|
now be useable on 2.4, but this hasn't actually been tested. Thanks
|
||||||
Dan Colish for the patch.
|
Dan Colish for the patch.
|
||||||
* Optimized some code using izip and islice.
|
* Optimized some code using izip and islice.
|
||||||
* Better error handling
|
* Better error handling
|
||||||
* Subscription status is now reset after every (re)connection.
|
* Subscription status is now reset after every (re)connection.
|
||||||
- Added spec file license header
|
- Added spec file license header
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-redis
|
# spec file for package python-redis
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -27,13 +27,18 @@ License: MIT
|
|||||||
URL: https://github.com/redis/redis-py
|
URL: https://github.com/redis/redis-py
|
||||||
Source0: https://files.pythonhosted.org/packages/source/r/redis/redis-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/r/redis/redis-%{version}.tar.gz
|
||||||
Source1: https://raw.githubusercontent.com/redis/redis-py/5.0/pytest.ini
|
Source1: https://raw.githubusercontent.com/redis/redis-py/5.0/pytest.ini
|
||||||
|
Patch0: increase-test-timeout.patch
|
||||||
|
# PATCH-FIX-UPSTREAM https://github.com/redis/redis-py/pull/3005
|
||||||
|
Patch1: Close-various-objects-created-during-asyncio-tests.patch
|
||||||
BuildRequires: %{python_module async-timeout >= 4.0.2}
|
BuildRequires: %{python_module async-timeout >= 4.0.2}
|
||||||
BuildRequires: %{python_module base >= 3.7}
|
BuildRequires: %{python_module base >= 3.7}
|
||||||
BuildRequires: %{python_module packaging}
|
BuildRequires: %{python_module packaging}
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module pytest-asyncio}
|
BuildRequires: %{python_module pytest-asyncio}
|
||||||
BuildRequires: %{python_module pytest-timeout}
|
BuildRequires: %{python_module pytest-timeout}
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: psmisc
|
BuildRequires: psmisc
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
@ -50,9 +55,13 @@ BuildArch: noarch
|
|||||||
The Python interface to the Redis key-value store.
|
The Python interface to the Redis key-value store.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1 -n redis-%{version}
|
%autosetup -N -n redis-%{version}
|
||||||
# pytest.ini for pytest markers
|
# pytest.ini for pytest markers
|
||||||
cp %SOURCE1 .
|
cp %SOURCE1 .
|
||||||
|
%ifarch s390x
|
||||||
|
%patch -P 0 -p1
|
||||||
|
%endif
|
||||||
|
%patch -P 1 -p1
|
||||||
|
|
||||||
# This test passes locally but fails in obs with different
|
# This test passes locally but fails in obs with different
|
||||||
# environment, like ALP build...
|
# environment, like ALP build...
|
||||||
@ -65,10 +74,10 @@ rm tests/test_json.py
|
|||||||
rm tests/test_timeseries.py
|
rm tests/test_timeseries.py
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%if %{with testing}
|
%if %{with testing}
|
||||||
@ -97,11 +106,6 @@ donttest="test_geopos or test_georadius"
|
|||||||
donttest="$donttest or test_xautoclaim"
|
donttest="$donttest or test_xautoclaim"
|
||||||
# gh#redis/redis-py#2679
|
# gh#redis/redis-py#2679
|
||||||
donttest+=" or test_acl_getuser_setuser or test_acl_log"
|
donttest+=" or test_acl_getuser_setuser or test_acl_log"
|
||||||
%if "%{_arch}" != "x86_64"
|
|
||||||
# flaky tests running in OBS for different arches, ppc64le, s390x
|
|
||||||
donttest+=" or blocking_timeout"
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%pytest -m 'not (onlycluster or redismod or ssl)' -k "not ($donttest)" --ignore tests/test_ssl.py --ignore tests/test_asyncio/test_cluster.py --redis-url=redis://localhost:6379/
|
%pytest -m 'not (onlycluster or redismod or ssl)' -k "not ($donttest)" --ignore tests/test_ssl.py --ignore tests/test_asyncio/test_cluster.py --redis-url=redis://localhost:6379/
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user