commit:     e02921ac791bba8134dfa8e16f194608d69e2def
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 16 06:49:12 2021 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 16 14:17:39 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e02921ac

dev-python/redis-py: enable py3.10, fix tests

Closes: https://bugs.gentoo.org/774981
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 .../files/redis-py-3.5.3-fix-user-tests.patch      | 72 ++++++++++++++++++++++
 dev-python/redis-py/redis-py-3.5.3.ebuild          | 15 +++--
 2 files changed, 81 insertions(+), 6 deletions(-)

diff --git a/dev-python/redis-py/files/redis-py-3.5.3-fix-user-tests.patch 
b/dev-python/redis-py/files/redis-py-3.5.3-fix-user-tests.patch
new file mode 100644
index 00000000000..36ff4b0bf60
--- /dev/null
+++ b/dev-python/redis-py/files/redis-py-3.5.3-fix-user-tests.patch
@@ -0,0 +1,72 @@
+diff --git a/tests/test_commands.py b/tests/test_commands.py
+index 65e877c..448d30c 100644
+--- a/tests/test_commands.py
++++ b/tests/test_commands.py
+@@ -105,25 +105,24 @@ class TestRedisCommands(object):
+ 
+         # test enabled=False
+         assert r.acl_setuser(username, enabled=False, reset=True)
+-        assert r.acl_getuser(username) == {
+-            'categories': ['-@all'],
+-            'commands': [],
+-            'enabled': False,
+-            'flags': ['off'],
+-            'keys': [],
+-            'passwords': [],
+-        }
++        acl = r.acl_getuser(username)
++        assert acl['categories'] == ['-@all']
++        assert acl['commands'] == []
++        assert acl['keys'] == []
++        assert acl['passwords'] == []
++        assert 'off' in acl['flags']
++        assert acl['enabled'] is False
+ 
+         # test nopass=True
+         assert r.acl_setuser(username, enabled=True, reset=True, nopass=True)
+-        assert r.acl_getuser(username) == {
+-            'categories': ['-@all'],
+-            'commands': [],
+-            'enabled': True,
+-            'flags': ['on', 'nopass'],
+-            'keys': [],
+-            'passwords': [],
+-        }
++        acl = r.acl_getuser(username)
++        assert acl['categories'] == ['-@all']
++        assert acl['commands'] == []
++        assert acl['keys'] == []
++        assert acl['passwords'] == []
++        assert 'on' in acl['flags']
++        assert 'nopass' in acl['flags']
++        assert acl['enabled'] is True
+ 
+         # test all args
+         assert r.acl_setuser(username, enabled=True, reset=True,
+@@ -135,7 +134,7 @@ class TestRedisCommands(object):
+         assert set(acl['categories']) == set(['-@all', '+@set', '+@hash'])
+         assert set(acl['commands']) == set(['+get', '+mget', '-hset'])
+         assert acl['enabled'] is True
+-        assert acl['flags'] == ['on']
++        assert 'on' in acl['flags']
+         assert set(acl['keys']) == set([b'cache:*', b'objects:*'])
+         assert len(acl['passwords']) == 2
+ 
+@@ -154,7 +153,7 @@ class TestRedisCommands(object):
+         assert set(acl['categories']) == set(['-@all', '+@set', '+@hash'])
+         assert set(acl['commands']) == set(['+get', '+mget'])
+         assert acl['enabled'] is True
+-        assert acl['flags'] == ['on']
++        assert 'on' in acl['flags']
+         assert set(acl['keys']) == set([b'cache:*', b'objects:*'])
+         assert len(acl['passwords']) == 2
+ 
+@@ -193,7 +192,7 @@ class TestRedisCommands(object):
+ 
+         assert r.acl_setuser(username, enabled=False, reset=True)
+         users = r.acl_list()
+-        assert 'user %s off -@all' % username in users
++        assert len(users) == 2
+ 
+     @skip_if_server_version_lt(REDIS_6_VERSION)
+     def test_acl_setuser_categories_without_prefix_fails(self, r, request):

diff --git a/dev-python/redis-py/redis-py-3.5.3.ebuild 
b/dev-python/redis-py/redis-py-3.5.3.ebuild
index 6954d82304d..bd3db607218 100644
--- a/dev-python/redis-py/redis-py-3.5.3.ebuild
+++ b/dev-python/redis-py/redis-py-3.5.3.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8,9} pypy3 )
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
 
 inherit distutils-r1
 
@@ -18,16 +18,21 @@ S="${WORKDIR}/${MY_P}"
 LICENSE="MIT"
 SLOT="0"
 KEYWORDS="amd64 arm arm64 ~hppa ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
-IUSE="test"
-RESTRICT="!test? ( test )"
 
-DEPEND="
+BDEPEND="
        test? (
                dev-db/redis
                dev-python/mock[${PYTHON_USEDEP}]
        )
 "
 
+PATCHES=(
+       # https://github.com/andymccurdy/redis-py/issues/1459
+       "${FILESDIR}/${P}-fix-user-tests.patch"
+)
+
+distutils_enable_tests pytest
+
 python_prepare_all() {
        distutils-r1_python_prepare_all
 
@@ -73,5 +78,3 @@ src_test() {
        # Clean up afterwards
        kill "$(<"${redis_pid}")" || die
 }
-
-distutils_enable_tests pytest

Reply via email to