forked from pool/python-redis
- Rewrite logic for skipping tests
* Add skipped_tests
* Move list of skipped tests from spec to skipped_tests
* Add list of tests that need to be skipped exclusively for valkey
- Update valkey skipped test list to fix test suite with valkey >= 9.0.0
(bsc#1252957)
- Update general skipped test list with tests that fail in aarch64 and i586
- Add redis_opts rpm macro
* Allows us to properly check for redis/valkey >= 7.0.0, instead of
grepping for known major versions when adding the needed cli options
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-redis?expand=0&rev=109
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
4
_multibuild
Normal file
4
_multibuild
Normal file
@@ -0,0 +1,4 @@
|
||||
<multibuild>
|
||||
<package>test</package>
|
||||
</multibuild>
|
||||
|
||||
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
|
||||
1526
python-redis.changes
Normal file
1526
python-redis.changes
Normal file
File diff suppressed because it is too large
Load Diff
128
python-redis.spec
Normal file
128
python-redis.spec
Normal file
@@ -0,0 +1,128 @@
|
||||
#
|
||||
# spec file for package python-redis
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC and contributors
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%global flavor @BUILD_FLAVOR@%{nil}
|
||||
%if "%{flavor}" == "test"
|
||||
%define psuffix -test
|
||||
%bcond_without test
|
||||
%endif
|
||||
|
||||
%if "%{flavor}" == ""
|
||||
%define psuffix %{nil}
|
||||
%bcond_with test
|
||||
%endif
|
||||
|
||||
# Add needed cli opts when running redis-server if redis/valkey version >= 7.0.0
|
||||
%define redis_opts %[v"%(%{_sbindir}/redis-server --version | cut -d " " -f "3" | tr -d "v=")" >= v"7.0.0" ? "--enable-debug-command yes --enable-module-command yes" : ""]
|
||||
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-redis%{psuffix}
|
||||
Version: 7.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
|
||||
# Based on https://github.com/redis/redis-py/blob/master/dockers/sentinel.conf
|
||||
Source1: sentinel.conf
|
||||
Source2: skipped_tests
|
||||
Patch0: increase-test-timeout.patch
|
||||
# PATCH-FIX-UPSTREAM Based on gh#redis/redis-py#3830
|
||||
Patch1: remove-mock.patch
|
||||
Patch2: test_add_elem_no_quant.patch
|
||||
BuildRequires: %{python_module async-timeout >= 4.0.2 if %python-base < 3.11.3}
|
||||
BuildRequires: %{python_module base >= 3.7}
|
||||
BuildRequires: %{python_module hatchling}
|
||||
BuildRequires: %{python_module numpy}
|
||||
BuildRequires: %{python_module packaging}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: psmisc
|
||||
BuildRequires: python-rpm-macros
|
||||
%if %{with test}
|
||||
BuildRequires: %{python_module pybreaker >= 1.4}
|
||||
BuildRequires: %{python_module pytest-asyncio}
|
||||
BuildRequires: %{python_module pytest-cov}
|
||||
BuildRequires: %{python_module pytest-mock}
|
||||
BuildRequires: %{python_module pytest-timeout}
|
||||
BuildRequires: %{python_module redis = %{version}}
|
||||
BuildRequires: %{python_module redis-entraid}
|
||||
BuildRequires: redis
|
||||
%endif
|
||||
Requires: (python-async-timeout >= 4.0.2 if python-base < 3.11.3)
|
||||
Recommends: python-hiredis >= 1.0.0
|
||||
Recommends: redis
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
The Python interface to the Redis key-value store.
|
||||
|
||||
%prep
|
||||
%autosetup -N -n redis-%{version}
|
||||
%ifarch s390x
|
||||
%patch -P 0 -p1
|
||||
%endif
|
||||
%patch -P 1 -p1
|
||||
%patch -P 2 -p1
|
||||
|
||||
%if %{without test}
|
||||
%build
|
||||
%pyproject_wheel
|
||||
%endif
|
||||
|
||||
%if %{without test}
|
||||
%install
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
%endif
|
||||
|
||||
%if %{with test}
|
||||
%check
|
||||
# upstream's tox testsuite starts several servers in docker containers listening on different ports.
|
||||
# We just start two of them locally
|
||||
# master
|
||||
# https://github.com/redis/redis/pull/9920
|
||||
%{_sbindir}/redis-server --port 6379 --save "" %redis_opts &
|
||||
victims="$!"
|
||||
# replica
|
||||
%{_sbindir}/redis-server --port 6380 --save "" --replicaof localhost 6379 &
|
||||
victims="$victims $!"
|
||||
# sentinel
|
||||
cp %{SOURCE1} .
|
||||
%{_sbindir}/redis-sentinel sentinel.conf &
|
||||
victims="$victims $!"
|
||||
trap "kill $victims || true" EXIT
|
||||
sleep 2
|
||||
|
||||
# load list of tests to skip from skipped_tests
|
||||
source %{SOURCE2}
|
||||
|
||||
%pytest "${skipped_tests[@]}" $(%{_sbindir}/redis-server --version | grep -q 'Valkey' && echo "${valkey_skipped_tests[@]}") --redis-url=redis://localhost:6379/
|
||||
%endif
|
||||
|
||||
%if %{without test}
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
%{python_sitelib}/redis/
|
||||
%{python_sitelib}/redis-%{version}.dist-info
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
3
redis-7.0.1.tar.gz
Normal file
3
redis-7.0.1.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c949df947dca995dc68fdf5a7863950bf6df24f8d6022394585acc98e81624f1
|
||||
size 4755322
|
||||
72
remove-mock.patch
Normal file
72
remove-mock.patch
Normal file
@@ -0,0 +1,72 @@
|
||||
From fa9c6df7975a7105d265c7e05cc84391060f9478 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Kowalik <steven@wedontsleep.org>
|
||||
Date: Mon, 3 Nov 2025 13:56:52 +1100
|
||||
Subject: [PATCH] Remove last vestiges of mock.mock
|
||||
|
||||
With the minimum Python version now being high enough to drop the usage
|
||||
of the external mock module, switch to unittest.mock everywhere.
|
||||
---
|
||||
dev_requirements.txt | 2 --
|
||||
tests/test_asyncio/test_credentials.py | 2 +-
|
||||
tests/test_asyncio/test_multidb/test_healthcheck.py | 3 ++-
|
||||
tests/test_credentials.py | 2 +-
|
||||
4 files changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: redis-7.0.1/dev_requirements.txt
|
||||
===================================================================
|
||||
--- redis-7.0.1.orig/dev_requirements.txt
|
||||
+++ redis-7.0.1/dev_requirements.txt
|
||||
@@ -2,8 +2,6 @@ build
|
||||
build==1.2.2.post1 ; platform_python_implementation == "PyPy" or python_version < "3.10"
|
||||
click==8.0.4
|
||||
invoke==2.2.0
|
||||
-mock
|
||||
-mock==5.1.0 ; platform_python_implementation == "PyPy" or python_version < "3.10"
|
||||
packaging>=20.4
|
||||
packaging==24.2 ; platform_python_implementation == "PyPy" or python_version < "3.10"
|
||||
|
||||
Index: redis-7.0.1/tests/test_asyncio/test_credentials.py
|
||||
===================================================================
|
||||
--- redis-7.0.1.orig/tests/test_asyncio/test_credentials.py
|
||||
+++ redis-7.0.1/tests/test_asyncio/test_credentials.py
|
||||
@@ -4,11 +4,11 @@ import string
|
||||
from asyncio import Lock as AsyncLock
|
||||
from asyncio import sleep as async_sleep
|
||||
from typing import Optional, Tuple, Union
|
||||
+from unittest.mock import Mock, call
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import redis
|
||||
-from mock.mock import Mock, call
|
||||
from redis import AuthenticationError, DataError, RedisError, ResponseError
|
||||
from redis.asyncio import Connection, ConnectionPool, Redis
|
||||
from redis.asyncio.retry import Retry
|
||||
Index: redis-7.0.1/tests/test_asyncio/test_multidb/test_healthcheck.py
|
||||
===================================================================
|
||||
--- redis-7.0.1.orig/tests/test_asyncio/test_multidb/test_healthcheck.py
|
||||
+++ redis-7.0.1/tests/test_asyncio/test_multidb/test_healthcheck.py
|
||||
@@ -1,5 +1,6 @@
|
||||
+from unittest.mock import AsyncMock, Mock
|
||||
+
|
||||
import pytest
|
||||
-from mock.mock import AsyncMock, Mock
|
||||
|
||||
from redis.asyncio.multidb.database import Database
|
||||
from redis.asyncio.multidb.healthcheck import (
|
||||
Index: redis-7.0.1/tests/test_credentials.py
|
||||
===================================================================
|
||||
--- redis-7.0.1.orig/tests/test_credentials.py
|
||||
+++ redis-7.0.1/tests/test_credentials.py
|
||||
@@ -4,10 +4,10 @@ import string
|
||||
import threading
|
||||
from time import sleep
|
||||
from typing import Optional, Tuple, Union
|
||||
+from unittest.mock import Mock, call
|
||||
|
||||
import pytest
|
||||
import redis
|
||||
-from mock.mock import Mock, call
|
||||
from redis import AuthenticationError, DataError, Redis, ResponseError
|
||||
from redis.auth.err import RequestTokenErr
|
||||
from redis.backoff import NoBackoff
|
||||
5
sentinel.conf
Normal file
5
sentinel.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
sentinel resolve-hostnames yes
|
||||
sentinel monitor redis-py-test localhost 6379 2
|
||||
sentinel down-after-milliseconds redis-py-test 5000
|
||||
sentinel failover-timeout redis-py-test 60000
|
||||
sentinel parallel-syncs redis-py-test 1
|
||||
55
skipped_tests
Normal file
55
skipped_tests
Normal file
@@ -0,0 +1,55 @@
|
||||
skipped_tests=(
|
||||
# onlycluster: skip tests which require a full cluster
|
||||
# redismod: Not available (https://github.com/RedisLabsModules/redismod)
|
||||
# ssl: no stunnel with certs from docker container, fails at test collection
|
||||
-m='not (onlycluster or redismod or ssl)'
|
||||
|
||||
# broken tests in ppc64le
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_geopos
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_georadius
|
||||
|
||||
# broken in aarch64 and i586
|
||||
--deselect=tests/test_asyncio/test_commands.py::TestRedisCommands::test_geopos
|
||||
|
||||
# broken tests in aarch64
|
||||
--deselect=tests/test_asyncio/test_commands.py::TestRedisCommands::test_georadius_with
|
||||
--deselect=tests/test_asyncio/test_commands.py::TestRedisCommands::test_georadius_store_dist
|
||||
--deselect=tests/test_asyncio/test_commands.py::TestRedisCommands::test_georadiusmember
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_geosearch_member
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_geosearch_with
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_geosearchstore_dist
|
||||
|
||||
# gh#redis/redis-py#2554
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_xautoclaim
|
||||
|
||||
# gh#python/cpython#70654 -- Fix only present in python313 so disable the tests
|
||||
--deselect=tests/test_asyncio/test_credentials.py::TestStreamingCredentialProvider::test_re_auth_pub_sub_in_resp3
|
||||
--deselect=tests/test_asyncio/test_credentials.py::TestStreamingCredentialProvider::test_do_not_re_auth_pub_sub_in_resp2
|
||||
|
||||
# gh#redis/redis-py#2679
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_acl_list
|
||||
|
||||
# Requires more sentinel services running
|
||||
--deselect=tests/test_sentinel.py::test_get_sentinels
|
||||
--deselect=tests/test_sentinel.py::test_get_master_addr_by_name
|
||||
--deselect=tests/test_asyncio/test_sentinel.py::test_get_sentinels
|
||||
--deselect=tests/test_asyncio/test_sentinel.py::test_get_master_addr_by_name
|
||||
|
||||
# The openSUSE redis json, bloom, ts are missing in the repos
|
||||
--ignore=tests/test_bloom.py
|
||||
--ignore=tests/test_json.py
|
||||
--ignore=tests/test_timeseries.py
|
||||
|
||||
# Tests that may require more set up and are ignored in upstream CI pipelines
|
||||
--ignore=tests/test_scenario
|
||||
--ignore=tests/test_asyncio/test_scenario
|
||||
)
|
||||
|
||||
valkey_skipped_tests=(
|
||||
# Tests that pass with redis but fail with valkey for various reasons
|
||||
--deselect=tests/test_asyncio/test_commands.py::TestRedisCommands::test_readonly_invalid_cluster_state
|
||||
--deselect=tests/test_asyncio/test_commands.py::TestRedisCommands::test_readonly_invalid_cluster_state
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_lolwut
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_readonly_invalid_cluster_state
|
||||
--deselect=tests/test_commands.py::TestRedisCommands::test_xgroup_create_entriesread
|
||||
)
|
||||
24
test_add_elem_no_quant.patch
Normal file
24
test_add_elem_no_quant.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
diff -Pdpru redis-py-6.2.0.orig/tests/test_asyncio/test_vsets.py redis-py-6.2.0/tests/test_asyncio/test_vsets.py
|
||||
--- redis-py-6.2.0.orig/tests/test_asyncio/test_vsets.py 2025-05-27 19:21:45.000000000 +0300
|
||||
+++ redis-py-6.2.0/tests/test_asyncio/test_vsets.py 2025-06-30 18:35:24.108629200 +0300
|
||||
@@ -83,7 +83,7 @@ async def test_add_elem_no_quant(d_clien
|
||||
assert resp == 1
|
||||
|
||||
emb = await d_client.vset().vemb("myset", "elem1")
|
||||
- assert _validate_quantization(float_array, emb, tolerance=0.0)
|
||||
+ assert _validate_quantization(float_array, emb, tolerance=0.00001)
|
||||
|
||||
|
||||
@skip_if_server_version_lt("7.9.0")
|
||||
diff -Pdpru redis-py-6.2.0.orig/tests/test_vsets.py redis-py-6.2.0/tests/test_vsets.py
|
||||
--- redis-py-6.2.0.orig/tests/test_vsets.py 2025-05-27 19:21:45.000000000 +0300
|
||||
+++ redis-py-6.2.0/tests/test_vsets.py 2025-06-30 18:35:03.140295444 +0300
|
||||
@@ -87,7 +87,7 @@ def test_add_elem_no_quant(d_client):
|
||||
assert resp == 1
|
||||
|
||||
emb = d_client.vset().vemb("myset", "elem1")
|
||||
- assert _validate_quantization(float_array, emb, tolerance=0.0)
|
||||
+ assert _validate_quantization(float_array, emb, tolerance=0.00001)
|
||||
|
||||
|
||||
@skip_if_server_version_lt("7.9.0")
|
||||
Reference in New Issue
Block a user