Compare commits
1 Commits
Author | SHA256 | Date | |
---|---|---|---|
9e8491f7b3 |
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()
|
@@ -1,74 +0,0 @@
|
||||
Index: python-redis/redis-5.2.1/tests/test_asyncio/test_scripting.py
|
||||
===================================================================
|
||||
--- python-redis.orig/redis-5.2.1/tests/test_asyncio/test_scripting.py
|
||||
+++ python-redis/redis-5.2.1/tests/test_asyncio/test_scripting.py
|
||||
@@ -28,14 +28,14 @@ class TestScripting:
|
||||
yield redis
|
||||
await redis.script_flush()
|
||||
|
||||
- @pytest.mark.asyncio(forbid_global_loop=True)
|
||||
+ @pytest.mark.asyncio()
|
||||
async def test_eval(self, r):
|
||||
await r.flushdb()
|
||||
await r.set("a", 2)
|
||||
# 2 * 3 == 6
|
||||
assert await r.eval(multiply_script, 1, "a", 3) == 6
|
||||
|
||||
- @pytest.mark.asyncio(forbid_global_loop=True)
|
||||
+ @pytest.mark.asyncio()
|
||||
@skip_if_server_version_lt("6.2.0")
|
||||
async def test_script_flush(self, r):
|
||||
await r.set("a", 2)
|
||||
@@ -55,14 +55,14 @@ class TestScripting:
|
||||
await r.script_load(multiply_script)
|
||||
await r.script_flush("NOTREAL")
|
||||
|
||||
- @pytest.mark.asyncio(forbid_global_loop=True)
|
||||
+ @pytest.mark.asyncio()
|
||||
async def test_evalsha(self, r):
|
||||
await r.set("a", 2)
|
||||
sha = await r.script_load(multiply_script)
|
||||
# 2 * 3 == 6
|
||||
assert await r.evalsha(sha, 1, "a", 3) == 6
|
||||
|
||||
- @pytest.mark.asyncio(forbid_global_loop=True)
|
||||
+ @pytest.mark.asyncio()
|
||||
async def test_evalsha_script_not_loaded(self, r):
|
||||
await r.set("a", 2)
|
||||
sha = await r.script_load(multiply_script)
|
||||
@@ -71,7 +71,7 @@ class TestScripting:
|
||||
with pytest.raises(exceptions.NoScriptError):
|
||||
await r.evalsha(sha, 1, "a", 3)
|
||||
|
||||
- @pytest.mark.asyncio(forbid_global_loop=True)
|
||||
+ @pytest.mark.asyncio()
|
||||
async def test_script_loading(self, r):
|
||||
# get the sha, then clear the cache
|
||||
sha = await r.script_load(multiply_script)
|
||||
@@ -80,7 +80,7 @@ class TestScripting:
|
||||
await r.script_load(multiply_script)
|
||||
assert await r.script_exists(sha) == [True]
|
||||
|
||||
- @pytest.mark.asyncio(forbid_global_loop=True)
|
||||
+ @pytest.mark.asyncio()
|
||||
async def test_script_object(self, r):
|
||||
await r.script_flush()
|
||||
await r.set("a", 2)
|
||||
@@ -97,7 +97,7 @@ class TestScripting:
|
||||
# Test first evalsha block
|
||||
assert await multiply(keys=["a"], args=[3]) == 6
|
||||
|
||||
- @pytest.mark.asyncio(forbid_global_loop=True)
|
||||
+ @pytest.mark.asyncio()
|
||||
async def test_script_object_in_pipeline(self, r):
|
||||
await r.script_flush()
|
||||
multiply = r.register_script(multiply_script)
|
||||
@@ -127,7 +127,7 @@ class TestScripting:
|
||||
assert await pipe.execute() == [True, b"2", 6]
|
||||
assert await r.script_exists(multiply.sha) == [True]
|
||||
|
||||
- @pytest.mark.asyncio(forbid_global_loop=True)
|
||||
+ @pytest.mark.asyncio()
|
||||
async def test_eval_msgpack_pipeline_error_in_lua(self, r):
|
||||
msgpack_hello = r.register_script(msgpack_hello_script)
|
||||
assert msgpack_hello.sha
|
@@ -2,7 +2,6 @@
|
||||
addopts = -s
|
||||
markers =
|
||||
redismod: run only the redis module tests
|
||||
graph: run only the redisgraph tests
|
||||
pipeline: pipeline tests
|
||||
onlycluster: marks tests to be run only with cluster mode redis
|
||||
onlynoncluster: marks tests to be run only with standalone redis
|
||||
@@ -12,8 +11,3 @@ markers =
|
||||
experimental: run only experimental tests
|
||||
asyncio_mode = auto
|
||||
timeout = 30
|
||||
filterwarnings =
|
||||
always
|
||||
ignore:RedisGraph support is deprecated as of Redis Stack 7.2:DeprecationWarning
|
||||
# Ignore a coverage warning when COVERAGE_CORE=sysmon for Pythons < 3.12.
|
||||
ignore:sys.monitoring isn't available:coverage.exceptions.CoverageWarning
|
||||
|
@@ -1,63 +1,3 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 13 10:59:14 UTC 2025 - Daniel Garcia <daniel.garcia@suse.com>
|
||||
|
||||
- Add pytest-asyncio-045.patch to make tests compatible with latest
|
||||
python-pytest-asyncio
|
||||
- Update to 5.2.1:
|
||||
* Fixed unsecured tempfile.mktemp() command usage (#3446)
|
||||
* Fixed bug with SLOWLOG GET response parsing on Redis Software (#3441)
|
||||
* Fixed issue with invoking _close() on closed event loop (#3438)
|
||||
* Migrate test infrastructure to new custom docker images (#3415)
|
||||
* Fixed flacky test with HEXPIREAT command (#3437)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 28 10:52:11 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Pin tests to pytest-asyncio < 0.24
|
||||
- Only require async-timeout for older pythons
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 20 17:54:16 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 5.2.0:
|
||||
* Extend AggregateRequest with scorer argument
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 7 21:56:28 UTC 2024 - Antonio Teixeira <antonio.teixeira@suse.com>
|
||||
|
||||
- Update to 5.1.1
|
||||
https://github.com/redis/redis-py/releases/tag/v5.1.1
|
||||
https://github.com/redis/redis-py/releases/tag/v5.1.0
|
||||
https://github.com/redis/redis-py/releases/tag/v5.0.9
|
||||
- Skip test_asyncio/test_commands.py, fails in OBS but passes locally
|
||||
- Use --enable-debug-command and --enable-module-command for valkey 8.x.x
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 30 15:22:51 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- replace with pypi tarball again
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 30 11:13:47 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- Fix filelist
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 29 18:55:58 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- Update to 5.0.8
|
||||
Required update to support Redis 7.4.0
|
||||
https://github.com/redis/redis-py/releases/tag/v5.0.8
|
||||
https://github.com/redis/redis-py/releases/tag/v5.0.7
|
||||
https://github.com/redis/redis-py/releases/tag/v5.0.6
|
||||
https://github.com/redis/redis-py/releases/tag/v5.0.5
|
||||
https://github.com/redis/redis-py/releases/tag/v5.0.4
|
||||
https://github.com/redis/redis-py/releases/tag/v5.0.3
|
||||
https://github.com/redis/redis-py/releases/tag/v5.0.2
|
||||
- drop Close-various-objects-created-during-asyncio-tests.patch
|
||||
included in update
|
||||
- New BR numpy for the testsuite
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 26 13:46:39 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-redis
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -20,19 +20,18 @@
|
||||
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-redis
|
||||
Version: 5.2.1
|
||||
Version: 5.0.1
|
||||
Release: 0
|
||||
Summary: Python client for Redis key-value store
|
||||
License: MIT
|
||||
URL: https://github.com/redis/redis-py
|
||||
Source0: https://files.pythonhosted.org/packages/source/r/redis/redis-%{version}.tar.gz
|
||||
Source1: https://github.com/redis/redis-py/raw/refs/tags/v%{version}/pytest.ini
|
||||
Source1: https://raw.githubusercontent.com/redis/redis-py/5.0/pytest.ini
|
||||
Patch0: increase-test-timeout.patch
|
||||
# PATCH-FIX-OPENSUSE pytest-asyncio-045.patch
|
||||
Patch1: pytest-asyncio-045.patch
|
||||
BuildRequires: %{python_module async-timeout >= 4.0.2 if %python-base < 3.11.3}
|
||||
# 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 base >= 3.7}
|
||||
BuildRequires: %{python_module numpy}
|
||||
BuildRequires: %{python_module packaging}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module pytest-asyncio}
|
||||
@@ -46,7 +45,7 @@ BuildRequires: python-rpm-macros
|
||||
%if %{with testing}
|
||||
BuildRequires: redis
|
||||
%endif
|
||||
Requires: (python-async-timeout >= 4.0.2 if python-base < 3.11.3)
|
||||
Requires: python-async-timeout >= 4.0.2
|
||||
Recommends: python-hiredis >= 1.0.0
|
||||
Recommends: redis
|
||||
BuildArch: noarch
|
||||
@@ -57,17 +56,16 @@ The Python interface to the Redis key-value store.
|
||||
|
||||
%prep
|
||||
%autosetup -N -n redis-%{version}
|
||||
# pytest.ini for pytest markers but without coverage
|
||||
sed /coverage/d %SOURCE1 > pytest.ini
|
||||
# pytest.ini for pytest markers
|
||||
cp %SOURCE1 .
|
||||
%ifarch s390x
|
||||
%patch -P 0 -p1
|
||||
%endif
|
||||
%patch -P 1 -p2
|
||||
%patch -P 1 -p1
|
||||
|
||||
# These tests pass locally but fail in obs with different
|
||||
# This test passes locally but fails in obs with different
|
||||
# environment, like ALP build...
|
||||
rm tests/test_commands.py*
|
||||
rm tests/test_asyncio/test_commands.py
|
||||
# The openSUSE redis json, bloom, ts and
|
||||
# graph are missing in the repos
|
||||
rm tests/test_bloom.py
|
||||
@@ -88,7 +86,7 @@ rm tests/test_timeseries.py
|
||||
# We just start two of them locally
|
||||
# master
|
||||
# https://github.com/redis/redis/pull/9920
|
||||
%{_sbindir}/redis-server --version | grep ' v=[78]\.' && redis7args="--enable-debug-command yes --enable-module-command yes"
|
||||
%{_sbindir}/redis-server --version | grep ' v=7\.' && redis7args="--enable-debug-command yes --enable-module-command yes"
|
||||
%{_sbindir}/redis-server --port 6379 --save "" $redis7args &
|
||||
victims="$!"
|
||||
trap "kill $victims || true" EXIT
|
||||
@@ -108,13 +106,13 @@ donttest="test_geopos or test_georadius"
|
||||
donttest="$donttest or test_xautoclaim"
|
||||
# gh#redis/redis-py#2679
|
||||
donttest+=" or test_acl_getuser_setuser or test_acl_log"
|
||||
%pytest -m 'not (onlycluster or redismod or ssl or graph)' -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
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
%{python_sitelib}/redis/
|
||||
%{python_sitelib}/redis-%{version}.dist-info
|
||||
%{python_sitelib}/redis-%{version}*-info
|
||||
|
||||
%changelog
|
||||
|
BIN
redis-5.0.1.tar.gz
(Stored with Git LFS)
Normal file
BIN
redis-5.0.1.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
redis-5.2.1.tar.gz
(Stored with Git LFS)
BIN
redis-5.2.1.tar.gz
(Stored with Git LFS)
Binary file not shown.
Reference in New Issue
Block a user