diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2021-11-01 11:57:04 +0200 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2021-11-01 12:08:55 +0200 |
commit | f8a484a18c7566ad0656531a0efdb8d385471cbb (patch) | |
tree | 0d211cb3f5ac0195ea0fc549ba1fd4e2b85b4c29 /dev-python/django-cacheops | |
parent | dev-python/django-cacheops: add github upstream metadata (diff) | |
download | gentoo-f8a484a18c7566ad0656531a0efdb8d385471cbb.tar.gz gentoo-f8a484a18c7566ad0656531a0efdb8d385471cbb.tar.bz2 gentoo-f8a484a18c7566ad0656531a0efdb8d385471cbb.zip |
dev-python/django-cacheops: enable tests
Closes: https://bugs.gentoo.org/797865
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-python/django-cacheops')
-rw-r--r-- | dev-python/django-cacheops/django-cacheops-5.1.ebuild | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/dev-python/django-cacheops/django-cacheops-5.1.ebuild b/dev-python/django-cacheops/django-cacheops-5.1.ebuild index 2bcc4a8d1943..35821ca12dd2 100644 --- a/dev-python/django-cacheops/django-cacheops-5.1.ebuild +++ b/dev-python/django-cacheops/django-cacheops-5.1.ebuild @@ -13,12 +13,49 @@ SRC_URI="mirror://pypi/${PN:0:1}"/${PN}/${P}.tar.gz LICENSE="BSD" SLOT="0" KEYWORDS="~amd64" +IUSE="test" +RESTRICT="!test? ( test )" -DEPEND=" +RDEPEND=" >=dev-python/django-1.8[${PYTHON_USEDEP}] >=dev-python/redis-py-2.9.1[${PYTHON_USEDEP}] >=dev-python/funcy-1.8[${PYTHON_USEDEP}] >=dev-python/six-1.4.0[${PYTHON_USEDEP}] " +BDEPEND=" + test? ( + ${RDEPEND} + dev-db/redis + ) +" + +src_prepare() { + # Remove test dependent on unpackaged before_after + sed -e 's/test_lock/_&/' -i tests/test_extras.py || die + distutils-r1_src_prepare +} + +python_test() { + local -x DJANGO_SETTINGS_MODULE=tests.settings + django-admin test -v 2 || die +} + +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 + daemonize yes + pidfile ${redis_pid} + port ${redis_port} + bind 127.0.0.1 + EOF + + # Run the tests + distutils-r1_src_test -RDEPEND="${DEPEND}" + # Clean up afterwards + kill "$(<"${redis_pid}")" || die +} |