Accepting request 1009191 from home:bnavigator:branches:devel:languages:python

- Update to 1.9.3
  * Removed python-six dependency
  * zadd support for GT/LT by @cunla in #49
  * Remove six dependency by @cunla in #51
  * Add host to conn_pool_args by @cunla in #51
- Drop python-fakeredis-no-six.patch which was incomplete
  * all commits, including the missing ones in release now
- Add fakeredis-pr54-fix-ensure_str.patch

OBS-URL: https://build.opensuse.org/request/show/1009191
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-fakeredis?expand=0&rev=19
This commit is contained in:
Dirk Mueller 2022-10-10 06:53:34 +00:00 committed by Git OBS Bridge
parent ebacc938b1
commit 3735292ed5
6 changed files with 55 additions and 263 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e2c29af30e5c02bf1fdae260d1f4be6f0d3fa0ac0a036584fe01373dd7ad6d9f
size 86742

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b90d30c6d8b72e3b83da804f92528e66ee30b58ae6f167091dedc858a2e1c20e
size 87068

View File

@ -0,0 +1,27 @@
From 8db1b02b8649540b0d649bb884ca1ad9a9937677 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Sun, 9 Oct 2022 21:35:45 +0200
Subject: [PATCH] Fix ensure_str
---
fakeredis/_fakesocket.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fakeredis/_fakesocket.py b/fakeredis/_fakesocket.py
index 71cc5e3..4452d32 100644
--- a/fakeredis/_fakesocket.py
+++ b/fakeredis/_fakesocket.py
@@ -1517,10 +1517,10 @@ def _convert_lua_result(self, result, nested=True):
return 1 if result else None
return result
- def ensure_str(self, s):
- return (s.decode(encoding='utf-8', errors='replace')
+ def ensure_str(self, s, encoding, replaceerr):
+ return (s.decode(encoding=encoding, errors=replaceerr)
if isinstance(s, bytes)
- else str(s).encode(encoding='utf-8', errors='replace'))
+ else str(s).encode(encoding=encoding, errors=replaceerr))
def _check_for_lua_globals(self, lua_runtime, expected_globals):
actual_globals = set(lua_runtime.globals().keys())

View File

@ -1,247 +0,0 @@
diff --git a/fakeredis/_basefakesocket.py b/fakeredis/_basefakesocket.py
index 76370d9..5dbb050 100644
--- a/fakeredis/_basefakesocket.py
+++ b/fakeredis/_basefakesocket.py
@@ -4,7 +4,6 @@
import weakref
import redis
-import six
from . import _msgs as msgs
from ._commands import (
@@ -190,7 +189,9 @@ def _blocking(self, timeout, func):
return ret
def _name_to_func(self, name):
- name = six.ensure_str(name, encoding='utf-8', errors='replace')
+ name = (name.decode(encoding='utf-8', errors='replace')
+ if isinstance(name, bytes)
+ else str(name).encode(encoding='utf-8', errors='replace'))
func_name = name.lower()
func = getattr(self, func_name, None)
if name.startswith('_') or not func or not hasattr(func, '_fakeredis_sig'):
diff --git a/fakeredis/_server.py b/fakeredis/_server.py
index 12e245e..b493799 100644
--- a/fakeredis/_server.py
+++ b/fakeredis/_server.py
@@ -127,7 +127,8 @@ def __init__(self, *args, server=None, connected=True, version=7, **kwargs):
'connection_class': FakeConnection,
'server': server
}
- conn_pool_args = [
+ conn_pool_args = {
+ 'host',
'db',
# Ignoring because AUTH is not implemented
# 'username',
@@ -139,8 +140,8 @@ def __init__(self, *args, server=None, connected=True, version=7, **kwargs):
'retry_on_timeout',
'max_connections',
'health_check_interval',
- 'client_name'
- ]
+ 'client_name',
+ }
for arg in conn_pool_args:
if arg in kwds:
kwargs[arg] = kwds[arg]
diff --git a/poetry.lock b/poetry.lock
index d6316d2..0b0eb10 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -56,7 +56,7 @@ dev = ["build (==0.8.0)", "flake8 (==4.0.1)", "hashin (==0.17.0)", "pip-tools (=
[[package]]
name = "certifi"
-version = "2022.6.15"
+version = "2022.9.24"
description = "Python package for providing Mozilla's CA Bundle."
category = "dev"
optional = false
@@ -119,7 +119,7 @@ toml = ["tomli"]
[[package]]
name = "cryptography"
-version = "37.0.4"
+version = "38.0.1"
description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."
category = "dev"
optional = false
@@ -132,7 +132,7 @@ cffi = ">=1.12"
docs = ["sphinx (>=1.6.5,!=1.8.0,!=3.1.0,!=3.1.1)", "sphinx-rtd-theme"]
docstest = ["pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"]
pep8test = ["black", "flake8", "flake8-import-order", "pep8-naming"]
-sdist = ["setuptools_rust (>=0.11.4)"]
+sdist = ["setuptools-rust (>=0.11.4)"]
ssh = ["bcrypt (>=3.1.5)"]
test = ["pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-subtests", "pytest-xdist", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"]
@@ -205,7 +205,7 @@ pyflakes = ">=2.5.0,<2.6.0"
[[package]]
name = "hypothesis"
-version = "6.54.4"
+version = "6.54.6"
description = "A library for property-based testing"
category = "dev"
optional = false
@@ -217,7 +217,7 @@ exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
sortedcontainers = ">=2.1.0,<3.0.0"
[package.extras]
-all = ["black (>=19.10b0)", "click (>=7.0)", "django (>=3.2)", "dpcontracts (>=0.4)", "lark-parser (>=0.6.5)", "libcst (>=0.3.16)", "numpy (>=1.9.0)", "pandas (>=1.0)", "pytest (>=4.6)", "python-dateutil (>=1.4)", "pytz (>=2014.1)", "redis (>=3.0.0)", "rich (>=9.0.0)", "importlib-metadata (>=3.6)", "backports.zoneinfo (>=0.2.1)", "tzdata (>=2022.1)"]
+all = ["black (>=19.10b0)", "click (>=7.0)", "django (>=3.2)", "dpcontracts (>=0.4)", "lark-parser (>=0.6.5)", "libcst (>=0.3.16)", "numpy (>=1.9.0)", "pandas (>=1.0)", "pytest (>=4.6)", "python-dateutil (>=1.4)", "pytz (>=2014.1)", "redis (>=3.0.0)", "rich (>=9.0.0)", "importlib-metadata (>=3.6)", "backports.zoneinfo (>=0.2.1)", "tzdata (>=2022.2)"]
cli = ["click (>=7.0)", "black (>=19.10b0)", "rich (>=9.0.0)"]
codemods = ["libcst (>=0.3.16)"]
dateutil = ["python-dateutil (>=1.4)"]
@@ -230,11 +230,11 @@ pandas = ["pandas (>=1.0)"]
pytest = ["pytest (>=4.6)"]
pytz = ["pytz (>=2014.1)"]
redis = ["redis (>=3.0.0)"]
-zoneinfo = ["backports.zoneinfo (>=0.2.1)", "tzdata (>=2022.1)"]
+zoneinfo = ["backports.zoneinfo (>=0.2.1)", "tzdata (>=2022.2)"]
[[package]]
name = "idna"
-version = "3.3"
+version = "3.4"
description = "Internationalized Domain Names in Applications (IDNA)"
category = "dev"
optional = false
@@ -274,7 +274,7 @@ python-versions = "*"
[[package]]
name = "jaraco.classes"
-version = "3.2.2"
+version = "3.2.3"
description = "Utility functions for Python class constructs"
category = "dev"
optional = false
@@ -284,8 +284,8 @@ python-versions = ">=3.7"
more-itertools = "*"
[package.extras]
-docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"]
-testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"]
+docs = ["sphinx (>=3.5)", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"]
+testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "flake8 (<5)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"]
[[package]]
name = "jeepney"
@@ -301,7 +301,7 @@ test = ["async-timeout", "trio", "testpath", "pytest-asyncio (>=0.17)", "pytest-
[[package]]
name = "keyring"
-version = "23.9.0"
+version = "23.9.3"
description = "Store and access your passwords safely."
category = "dev"
optional = false
@@ -520,7 +520,7 @@ python-versions = "*"
[[package]]
name = "readme-renderer"
-version = "37.1"
+version = "37.2"
description = "readme_renderer is a library for rendering \"readme\" descriptions for Warehouse"
category = "dev"
optional = false
@@ -625,7 +625,7 @@ jeepney = ">=0.6"
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
-category = "main"
+category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
@@ -637,14 +637,6 @@ category = "main"
optional = false
python-versions = "*"
-[[package]]
-name = "toml"
-version = "0.10.2"
-description = "Python Library for Tom's Obvious, Minimal Language"
-category = "dev"
-optional = false
-python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
-
[[package]]
name = "tomli"
version = "2.0.1"
@@ -655,7 +647,7 @@ python-versions = ">=3.7"
[[package]]
name = "tox"
-version = "3.25.1"
+version = "3.26.0"
description = "tox is a generic virtualenv management and test command line tool"
category = "dev"
optional = false
@@ -669,7 +661,7 @@ packaging = ">=14"
pluggy = ">=0.12.0"
py = ">=1.4.17"
six = ">=1.14.0"
-toml = ">=0.9.4"
+tomli = {version = ">=2.0.1", markers = "python_version >= \"3.7\" and python_version < \"3.11\""}
virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7"
[package.extras]
@@ -769,7 +761,7 @@ lua = ["lupa"]
[metadata]
lock-version = "1.1"
python-versions = "^3.7"
-content-hash = "397fb04cb476c4abb56ea30d8aa4d641c95afcb3241ff4aadbf6ac34b8a9339e"
+content-hash = "ec00a9373af1095b25586a0865eb86d2b3bacb521f6f8f4f900f359ea03f2b73"
[metadata.files]
aioredis = []
@@ -824,7 +816,6 @@ rich = []
secretstorage = []
six = []
sortedcontainers = []
-toml = []
tomli = []
tox = []
twine = []
diff --git a/pyproject.toml b/pyproject.toml
index bad2825..3fc522c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -14,7 +14,8 @@ readme = "README.md"
keywords = ["redis", "rq", "django-rq", "rq-scheduler"]
authors = [
"James Saryerwinnie <js@jamesls.com>",
- "Bruce Merry <bmerry@ska.ac.za>"
+ "Bruce Merry <bmerry@ska.ac.za>",
+ "Daniel Moran <daniel.maruani@gmail.com>"
]
maintainers = [
"Daniel Moran <daniel.maruani@gmail.com>"
@@ -39,7 +40,6 @@ repository = "https://github.com/cunla/fakeredis-py"
[tool.poetry.dependencies]
python = "^3.7"
redis = "<4.4"
-six = "^1.16.0"
sortedcontainers = "^2.4.0"
lupa = { version = "^1.13", optional = true }
aioredis = { version = "^2.0.1", optional = true }
diff --git a/test/test_init_args.py b/test/test_init_args.py
index b77eb24..1d79f39 100644
--- a/test/test_init_args.py
+++ b/test/test_init_args.py
@@ -24,6 +24,11 @@ def test_singleton(self):
assert 'bar' in r4
assert 'bar' not in r1
+ def test_host_init_arg(self):
+ db = fakeredis.FakeStrictRedis(host='localhost')
+ db.set('foo', 'bar')
+ assert db.get('foo') == b'bar'
+
def test_from_url(self):
db = fakeredis.FakeStrictRedis.from_url(
'redis://localhost:6379/0')

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Sun Oct 9 19:22:51 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 1.9.3
* Removed python-six dependency
* zadd support for GT/LT by @cunla in #49
* Remove six dependency by @cunla in #51
* Add host to conn_pool_args by @cunla in #51
- Drop python-fakeredis-no-six.patch which was incomplete
* all commits, including the missing ones in release now
- Add fakeredis-pr54-fix-ensure_str.patch
-------------------------------------------------------------------
Tue Sep 27 10:49:56 UTC 2022 - pgajdos@suse.com

View File

@ -17,32 +17,33 @@
Name: python-fakeredis
Version: 1.9.1
Version: 1.9.3
Release: 0
Summary: Fake implementation of redis API for testing purposes
License: BSD-3-Clause AND MIT
URL: https://github.com//dsoftwareinc/fakeredis
Source: https://github.com/dsoftwareinc/fakeredis-py/archive/refs/tags/v%{version}.tar.gz#/fakeredis-%{version}-gh.tar.gz
# https://github.com/cunla/fakeredis-py/pull/51/
Patch0: python-fakeredis-no-six.patch
# PATCH-FIX-UPSTREAM fakeredis-pr54-fix-ensure_str.patch gh#dsoftwareinc/fakeredis#54
Patch0: fakeredis-pr54-fix-ensure_str.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module poetry-core}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-redis
Requires: python-redis < 4.4
Requires: python-sortedcontainers >= 2.4.0
Suggests: (python-aioredis if python-redis < 4.2)
Suggests: python-lupa
Suggests: (python-aioredis >= 2.0.1)
Suggests: python-lupa >= 1.13
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module future}
# technically requires hypothesis >= 6.47.1, but we don't have it yet
BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module lupa}
BuildRequires: %{python_module pytest >= 4.0}
BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module lupa >= 1.13}
BuildRequires: %{python_module pytest >= 7.1.2}
BuildRequires: %{python_module pytest-asyncio >= 0.19.0}
# technically requires pytest-mock >= 3.7.0, but we don't have it yet
BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module redis}
BuildRequires: %{python_module redis < 4.4}
BuildRequires: %{python_module sortedcontainers >= 2.4.0}
# /SECTION
%python_subpackages
@ -51,8 +52,7 @@ BuildRequires: %{python_module sortedcontainers >= 2.4.0}
Fake implementation of redis API for testing purposes.
%prep
%setup -q -n fakeredis-py-%{version}
%patch0 -p1
%autosetup -p1 -n fakeredis-py-%{version}
%build
%pyproject_wheel