summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-python/fakeredis/Manifest1
-rw-r--r--dev-python/fakeredis/fakeredis-2.11.0.ebuild77
2 files changed, 78 insertions, 0 deletions
diff --git a/dev-python/fakeredis/Manifest b/dev-python/fakeredis/Manifest
index ec3481aeb318..30517cf3c9d7 100644
--- a/dev-python/fakeredis/Manifest
+++ b/dev-python/fakeredis/Manifest
@@ -1,2 +1,3 @@
DIST fakeredis-2.10.3.tar.gz 94025 BLAKE2B faf178d53e783c4475513bf9f485b6eaefc63bc45c5ebd95ecfa1aaed982e236877230ea19526d8d12f152f1c429c5003b04abd2cc4f7ed43dbde581b07fbdf1 SHA512 694b1b540e8b9b32a5a44e3094b8bab307c5af400335efe9eb034c5ed161c1583d4700c08ef16991a1f03502aeb835d89b327448c3385de548dd39aafdbcc2a8
+DIST fakeredis-2.11.0.tar.gz 94957 BLAKE2B 0f1e5e226793fbeb86c9d7b894832652dca65c2ed21b0f0c86c228df3124f97aebc1540619fdb484dda93a78f7c7d6e1fbbcd07a24ba0e919ba9fb718074c757 SHA512 7669fa06737f47440b85a369ae00429da7ee479dcc0fed3c5a33f700b3ddbe3660bfd1098dcefa4b29896dc552cca950fa8305f1e53b44fd82f8375e15d25031
DIST fakeredis-py-2.10.2.gh.tar.gz 159702 BLAKE2B ec385c01af9e32705435148c1c61d74c14d7b22a60b6a3466f1831f557bfe997af6ee96429cfdba00a1328db3cabe1579d65411e7c2b9972e5421963cd66815b SHA512 2a3a87dcbe136465ff0465585562a5b8b0bc73504f491d3ec9c6e959b6cffaa3edbaa1c2e5199138f7a49dfdec3c3da6a2ae338228a8fe21c670a82c062c544a
diff --git a/dev-python/fakeredis/fakeredis-2.11.0.ebuild b/dev-python/fakeredis/fakeredis-2.11.0.ebuild
new file mode 100644
index 000000000000..425cda7c342a
--- /dev/null
+++ b/dev-python/fakeredis/fakeredis-2.11.0.ebuild
@@ -0,0 +1,77 @@
+# Copyright 2020-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=poetry
+PYTHON_COMPAT=( pypy3 python3_{9..11} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Fake implementation of redis API for testing purposes"
+HOMEPAGE="
+ https://github.com/cunla/fakeredis-py/
+ https://pypi.org/project/fakeredis/
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
+
+RDEPEND="
+ >=dev-python/redis-4.2[${PYTHON_USEDEP}]
+ <dev-python/sortedcontainers-3[${PYTHON_USEDEP}]
+ >=dev-python/sortedcontainers-2.4.0[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ test? (
+ dev-db/redis
+ dev-python/pytest-asyncio[${PYTHON_USEDEP}]
+ dev-python/pytest-mock[${PYTHON_USEDEP}]
+ )
+"
+
+distutils_enable_tests pytest
+
+python_test() {
+ local EPYTEST_DESELECT=(
+ # also lupa
+ test/test_aioredis2.py::test_failed_script_error
+ # TODO
+ "test/test_fakeredis.py::test_set_get_nx[StrictRedis]"
+ "test/test_fakeredis.py::test_lpop_count[StrictRedis]"
+ "test/test_fakeredis.py::test_rpop_count[StrictRedis]"
+ "test/test_fakeredis.py::test_zadd_minus_zero[StrictRedis]"
+ "test/test_mixins/test_pubsub_commands.py::test_pubsub_channels[StrictRedis]"
+ test/test_mixins/test_set_commands.py::test_smismember_wrong_type
+ )
+ local EPYTEST_IGNORE=(
+ # these tests fail a lot...
+ test/test_hypothesis.py
+ )
+ local args=(
+ # tests requiring lupa (lua support)
+ -k 'not test_eval and not test_lua and not test_script'
+ )
+ epytest "${args[@]}"
+}
+
+src_test() {
+ local redis_pid="${T}"/redis.pid
+ local redis_port=6379
+
+ einfo "Spawning Redis"
+ einfo "NOTE: Port ${redis_port} must be free"
+ "${EPREFIX}"/usr/sbin/redis-server - <<- EOF || die "Unable to start redis server"
+ daemonize yes
+ pidfile ${redis_pid}
+ port ${redis_port}
+ bind 127.0.0.1
+ EOF
+
+ # Run the tests
+ distutils-r1_src_test
+
+ # Clean up afterwards
+ kill "$(<"${redis_pid}")" || die
+}