1 |
commit: f8a484a18c7566ad0656531a0efdb8d385471cbb |
2 |
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Nov 1 09:57:04 2021 +0000 |
4 |
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 1 10:08:55 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8a484a1 |
7 |
|
8 |
dev-python/django-cacheops: enable tests |
9 |
|
10 |
Closes: https://bugs.gentoo.org/797865 |
11 |
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> |
12 |
|
13 |
.../django-cacheops/django-cacheops-5.1.ebuild | 41 ++++++++++++++++++++-- |
14 |
1 file changed, 39 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/dev-python/django-cacheops/django-cacheops-5.1.ebuild b/dev-python/django-cacheops/django-cacheops-5.1.ebuild |
17 |
index 2bcc4a8d194..35821ca12dd 100644 |
18 |
--- a/dev-python/django-cacheops/django-cacheops-5.1.ebuild |
19 |
+++ b/dev-python/django-cacheops/django-cacheops-5.1.ebuild |
20 |
@@ -13,12 +13,49 @@ SRC_URI="mirror://pypi/${PN:0:1}"/${PN}/${P}.tar.gz |
21 |
LICENSE="BSD" |
22 |
SLOT="0" |
23 |
KEYWORDS="~amd64" |
24 |
+IUSE="test" |
25 |
+RESTRICT="!test? ( test )" |
26 |
|
27 |
-DEPEND=" |
28 |
+RDEPEND=" |
29 |
>=dev-python/django-1.8[${PYTHON_USEDEP}] |
30 |
>=dev-python/redis-py-2.9.1[${PYTHON_USEDEP}] |
31 |
>=dev-python/funcy-1.8[${PYTHON_USEDEP}] |
32 |
>=dev-python/six-1.4.0[${PYTHON_USEDEP}] |
33 |
" |
34 |
+BDEPEND=" |
35 |
+ test? ( |
36 |
+ ${RDEPEND} |
37 |
+ dev-db/redis |
38 |
+ ) |
39 |
+" |
40 |
+ |
41 |
+src_prepare() { |
42 |
+ # Remove test dependent on unpackaged before_after |
43 |
+ sed -e 's/test_lock/_&/' -i tests/test_extras.py || die |
44 |
+ distutils-r1_src_prepare |
45 |
+} |
46 |
+ |
47 |
+python_test() { |
48 |
+ local -x DJANGO_SETTINGS_MODULE=tests.settings |
49 |
+ django-admin test -v 2 || die |
50 |
+} |
51 |
+ |
52 |
+src_test() { |
53 |
+ local redis_pid="${T}"/redis.pid |
54 |
+ local redis_port=6379 |
55 |
+ |
56 |
+ einfo "Spawning Redis" |
57 |
+ einfo "NOTE: Port ${redis_port} must be free" |
58 |
+ "${EPREFIX}"/usr/sbin/redis-server - <<-EOF || die |
59 |
+ daemonize yes |
60 |
+ pidfile ${redis_pid} |
61 |
+ port ${redis_port} |
62 |
+ bind 127.0.0.1 |
63 |
+ EOF |
64 |
+ |
65 |
+ # Run the tests |
66 |
+ distutils-r1_src_test |
67 |
|
68 |
-RDEPEND="${DEPEND}" |
69 |
+ # Clean up afterwards |
70 |
+ kill "$(<"${redis_pid}")" || die |
71 |
+} |