commit: 16fd5a7788d7f3fcd8dae6710bba6b4072c4b0ee
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 7 02:44:44 2023 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 7 03:01:14 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16fd5a77
dev-python/aiocache: Enable acceptance tests
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/aiocache/aiocache-0.12.2.ebuild | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/dev-python/aiocache/aiocache-0.12.2.ebuild
b/dev-python/aiocache/aiocache-0.12.2.ebuild
index bba70b471f05..654d767ca7eb 100644
--- a/dev-python/aiocache/aiocache-0.12.2.ebuild
+++ b/dev-python/aiocache/aiocache-0.12.2.ebuild
@@ -20,6 +20,7 @@ KEYWORDS="~amd64 ~x86"
BDEPEND="
test? (
+ dev-db/redis
>=dev-python/msgpack-0.5.5[${PYTHON_USEDEP}]
dev-python/pytest-asyncio[${PYTHON_USEDEP}]
>=dev-python/redis-4.2.0[${PYTHON_USEDEP}]
@@ -30,9 +31,6 @@ distutils_enable_tests pytest
python_test() {
local EPYTEST_IGNORE=(
- # require running servers
- # TODO: start redis and enable them
- tests/acceptance
# benchmarks
tests/performance
# requires aiomcache
@@ -41,3 +39,24 @@ python_test() {
epytest -o addopts= -m "not memcached"
}
+
+src_test() {
+ local redis_pid="${T}"/redis.pid
+ local redis_port=6379
+
+ # Spawn Redis for testing purposes
+ 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 ::1
+ EOF
+
+ # Run the tests
+ distutils-r1_src_test
+
+ # Clean up afterwards
+ kill "$(<"${redis_pid}")" || die
+}