diff options
Diffstat (limited to 'dev-python/fakeredis')
| -rw-r--r-- | dev-python/fakeredis/Manifest | 2 | ||||
| -rw-r--r-- | dev-python/fakeredis/fakeredis-2.40.0.ebuild | 139 |
2 files changed, 141 insertions, 0 deletions
diff --git a/dev-python/fakeredis/Manifest b/dev-python/fakeredis/Manifest index a73f6bf1eae2..c4c86a65c1b6 100644 --- a/dev-python/fakeredis/Manifest +++ b/dev-python/fakeredis/Manifest @@ -6,3 +6,5 @@ DIST fakeredis-2.38.0.tar.gz 271116 BLAKE2B c16d21d194a2589363a753737fbbe0729ead DIST fakeredis-2.38.0.tar.gz.provenance 9942 BLAKE2B e29e23b6ec2a64fcbbe8c078ea0b01aa728d81a63e6c4898971187184aa59bfb219c072d8933bc4ae64040db6d89b7ad334b4489b6da8e2d640c639200e33fa2 SHA512 18400e533c3471d087e8429a41d5cb664a023a5bc12276f0021aeb9616dd7c18523284716f9a89c93ac3f30019f6540bb3935c6a7073f43fd59d4644afb499ba DIST fakeredis-2.39.0.tar.gz 301722 BLAKE2B 4f0550eb73f0b67061cc96e6b44bca7920aaa423563ab0c588ed264259e340de20a417c4535f82dc09714d6902d9bc298e07145b27ac72c3642bb3b387c74d2e SHA512 b0b15942440a0926ebb40db4ffe49e80d35bddf59de6919d3c68b651ddab6ebce17f7310406bc2c9ee5fe912f875a6bf58430392652ec95c18cbc5c7f839b7ca DIST fakeredis-2.39.0.tar.gz.provenance 9797 BLAKE2B 07d67ab697bee1676aa436aaeb30e10628cc407823d1ce3f4a4c9187f1a9862050d720c6d2c70bacc082d4244c48968dae848ff615115f50ec8084f757ff0547 SHA512 b50b217469ca5fc2629e297823abfd2f83c398cbb4c4dda962c59286eb3af0c811d8cbadaf1d0291edf1f95916db96587a559a1279dda9bba6e95fabca7375d7 +DIST fakeredis-2.40.0.tar.gz 332674 BLAKE2B 1dc0b7797d59a895ec93c171f0797daace9c9d11dc17182f714488030a31b3b28cc53c20723454e2430923f2dc7d8d3ed305bca08592e3045ab43eca3ca96c98 SHA512 215a23b61976b7418172a9c28a7646469127a1caa8dcb388fede54d6d64d83fd9691d41b58d7bb3fc4e46c1828ca0b5d7c97371b33b542a839b84c38f75dbf3b +DIST fakeredis-2.40.0.tar.gz.provenance 9869 BLAKE2B 5fa1cfb9ffe0713dbf21a3685f90b2e80b4009b39401cdf7f1ced6d6b4a5c3d392d33e9fa5f6df5d966e3c83f03261c86e66c94df47f649561ea0ec7d5ab6e12 SHA512 6f2db02bfa3f52c4739fc5c58c8b4d14c7d238ed0540c31ea86ab0adef8c34ef1c10352f0452b28e2d513efc56ceb8661426e681a9bce4ab650ae48cd04231bb diff --git a/dev-python/fakeredis/fakeredis-2.40.0.ebuild b/dev-python/fakeredis/fakeredis-2.40.0.ebuild new file mode 100644 index 000000000000..31767ad12918 --- /dev/null +++ b/dev-python/fakeredis/fakeredis-2.40.0.ebuild @@ -0,0 +1,139 @@ +# Copyright 2020-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=hatchling +PYPI_VERIFY_REPO=https://github.com/cunla/fakeredis-py +PYTHON_COMPAT=( python3_{13..14} ) + +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 ~ppc64 ~riscv ~sparc ~x86" + +RDEPEND=" + >=dev-python/redis-4.3[${PYTHON_USEDEP}] + >=dev-python/sortedcontainers-2[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + dev-db/redis + dev-db/valkey + dev-python/packaging[${PYTHON_USEDEP}] + dev-python/valkey[${PYTHON_USEDEP}] + ) +" + +EPYTEST_PLUGINS=( pytest-{asyncio,mock} ) +EPYTEST_XDIST=1 +distutils_enable_tests pytest + +src_prepare() { + distutils-r1_src_prepare + + # do not install duplicate license + sed -i -e '\@fakeredis/LICENSE@d' pyproject.toml || die +} + +wait_for_status() { + local expected=${1} + + local i + for i in {1..50}; do + "${server}-cli" -p "${redis_port}" ping + [[ ${?} -eq ${expected} ]] && return + sleep 0.2 + done + + die "Timeout while waiting for ${1}-server to start/stop" +} + +src_test() { + local server + for server in redis valkey; do + local redis_pid="${T}/${server}.pid" + local redis_port=6390 + local redis_log="${T}/${server}.log" + local redis_db="${T}/${server}.db" + + einfo "Running ${server} server tests" + "${EPREFIX}/usr/sbin/${server}-server" - <<- EOF || die "Unable to start ${server} server" + daemonize yes + pidfile ${redis_pid} + port ${redis_port} + logfile ${redis_log} + dir ${redis_db%/*} + dbfilename ${redis_db##*/} + bind 127.0.0.1 + EOF + + # wait for the server to start + wait_for_status 0 + + distutils-r1_src_test + + "${server}-cli" -p "${redis_port}" shutdown || die "Unable to stop ${server} server" + + # wait for the server to stop + wait_for_status 1 + done +} + +python_test() { + local EPYTEST_DESELECT=( + # json ext + test/test_stack/test_json.py + test/test_stack/test_json_arr_commands.py + test/test_stack/test_json_fpha.py + # eval command + test/test_internals/test_reply_shaping.py::test_nested_replies_reach_the_client_intact + # TODO + "test/test_mixins/test_pubsub_commands.py::test_published_message_to_shard_channel[Strict3]" + "test/test_mixins/test_pubsub_commands.py::test_pubsub_shardnumsub[Strict2]" + "test/test_mixins/test_pubsub_commands.py::test_pubsub_shardnumsub[Strict3]" + ) + + local EPYTEST_IGNORE=( + # these tests fail a lot... + test/test_hypothesis + test/test_hypothesis_joint.py + ) + + case ${server} in + redis) + EPYTEST_DESELECT+=( + "test/test_mixins/test_acl_commands.py::test_acl_cat[Strict2]" + "test/test_mixins/test_acl_commands.py::test_acl_cat[Strict3]" + "test/test_async/test_redis_only.py::test_async_lock[fake_resp2]" + "test/test_async/test_redis_only.py::test_async_lock[fake_resp3]" + "test/test_mixins/test_set_commands.py::test_smismember_wrong_type[FakeStrict2]" + "test/test_mixins/test_set_commands.py::test_smismember_wrong_type[FakeStrict3]" + "test/test_mixins/test_set_commands.py::test_smismember_wrong_type[Strict2]" + "test/test_mixins/test_set_commands.py::test_smismember_wrong_type[Strict3]" + ) + + # run fake tests only once + # TODO: figure out how to run tcp_server tests + # they fail if a server is running, + # and conftest fails if one isn't running + epytest -m "not real and not tcp_server" + ;; + valkey) + EPYTEST_DESELECT+=( + test/test_stack/test_vectorset.py + ) + ;; + esac + + # we can run "fake" tests in parallel, but "real" seem to share + # the same connection + EPYTEST_XDIST= epytest -m "real" +} |
