Sync from SUSE:SLFO:Main python-redis revision 1505c3fe02620c19027d95988ad0f03d

This commit is contained in:
2025-03-28 16:44:22 +01:00
parent 34cc81e6f0
commit 64f6560e70
6 changed files with 119 additions and 12 deletions

74
pytest-asyncio-045.patch Normal file
View File

@@ -0,0 +1,74 @@
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

View File

@@ -2,6 +2,7 @@
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
@@ -11,3 +12,8 @@ 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

View File

@@ -1,3 +1,27 @@
-------------------------------------------------------------------
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>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-redis
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -20,15 +20,17 @@
%{?sle15_python_module_pythons}
Name: python-redis
Version: 5.1.1
Version: 5.2.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://raw.githubusercontent.com/redis/redis-py/5.0/pytest.ini
Source1: https://github.com/redis/redis-py/raw/refs/tags/v%{version}/pytest.ini
Patch0: increase-test-timeout.patch
BuildRequires: %{python_module async-timeout >= 4.0.2}
# 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}
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module packaging}
@@ -44,7 +46,7 @@ BuildRequires: python-rpm-macros
%if %{with testing}
BuildRequires: redis
%endif
Requires: python-async-timeout >= 4.0.2
Requires: (python-async-timeout >= 4.0.2 if python-base < 3.11.3)
Recommends: python-hiredis >= 1.0.0
Recommends: redis
BuildArch: noarch
@@ -55,11 +57,12 @@ The Python interface to the Redis key-value store.
%prep
%autosetup -N -n redis-%{version}
# pytest.ini for pytest markers
cp %SOURCE1 .
# pytest.ini for pytest markers but without coverage
sed /coverage/d %SOURCE1 > pytest.ini
%ifarch s390x
%patch -P 0 -p1
%endif
%patch -P 1 -p2
# These tests pass locally but fail in obs with different
# environment, like ALP build...
@@ -105,13 +108,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)' -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 or graph)' -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}*-info
%{python_sitelib}/redis-%{version}.dist-info
%changelog

BIN
redis-5.1.1.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
redis-5.2.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.