1 |
commit: d2e3ddd7dce26b035a3e18cbdfa2f0f33bca1262 |
2 |
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Oct 15 05:35:06 2021 +0000 |
4 |
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 15 05:38:56 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2e3ddd7 |
7 |
|
8 |
dev-python/txAMQP: enable py3.10, enable tests |
9 |
|
10 |
Enable tests by spawning tabbitmq local server and running the tests |
11 |
over it. The tests server should be fully isolated and run inside |
12 |
${T} directory. |
13 |
|
14 |
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> |
15 |
|
16 |
dev-python/txAMQP/txAMQP-0.8.2.ebuild | 34 +++++++++++++++++++++++++--------- |
17 |
1 file changed, 25 insertions(+), 9 deletions(-) |
18 |
|
19 |
diff --git a/dev-python/txAMQP/txAMQP-0.8.2.ebuild b/dev-python/txAMQP/txAMQP-0.8.2.ebuild |
20 |
index 31f1d27c9d0..ee0ea7c19f3 100644 |
21 |
--- a/dev-python/txAMQP/txAMQP-0.8.2.ebuild |
22 |
+++ b/dev-python/txAMQP/txAMQP-0.8.2.ebuild |
23 |
@@ -3,23 +3,25 @@ |
24 |
|
25 |
EAPI=7 |
26 |
|
27 |
-PYTHON_COMPAT=( python3_{7..9} ) |
28 |
+PYTHON_COMPAT=( python3_{8..10} ) |
29 |
PYTHON_REQ_USE="xml(+)" |
30 |
|
31 |
inherit distutils-r1 |
32 |
|
33 |
-MY_P=${PN,,}-${PV} |
34 |
+MY_P="${PN,,}-${PV}" |
35 |
+ |
36 |
DESCRIPTION="Python library for communicating with AMQP peers using Twisted" |
37 |
HOMEPAGE="https://github.com/txamqp/txamqp" |
38 |
# pypi tarball misses doc files |
39 |
# https://github.com/txamqp/txamqp/pull/10 |
40 |
SRC_URI="https://github.com/txamqp/txamqp/archive/${PV}.tar.gz -> ${MY_P}.tar.gz" |
41 |
-S=${WORKDIR}/${MY_P} |
42 |
+S="${WORKDIR}/${MY_P}" |
43 |
|
44 |
LICENSE="Apache-2.0" |
45 |
-KEYWORDS="~amd64 ~x86 ~x64-solaris" |
46 |
SLOT="0" |
47 |
+KEYWORDS="~amd64 ~x86 ~x64-solaris" |
48 |
IUSE="test" |
49 |
+RESTRICT="!test? ( test )" |
50 |
|
51 |
RDEPEND=" |
52 |
dev-python/twisted[${PYTHON_USEDEP}] |
53 |
@@ -31,16 +33,12 @@ BDEPEND=" |
54 |
net-misc/rabbitmq-server |
55 |
)" |
56 |
|
57 |
-# Tests connect to the system rabbitmq server |
58 |
-# TODO: figure out how to start an isolated instance |
59 |
-RESTRICT="test" |
60 |
- |
61 |
python_test() { |
62 |
cd src || die |
63 |
# tests look for those files relatively to modules |
64 |
cp -r specs "${BUILD_DIR}"/lib || die |
65 |
|
66 |
- TXAMQP_BROKER=RABBITMQ trial txamqp |
67 |
+ TXAMQP_BROKER=RABBITMQ "${EPYTHON}" -m twisted.trial txamqp |
68 |
local ret=${?} |
69 |
|
70 |
# avoid installing spec files |
71 |
@@ -49,6 +47,24 @@ python_test() { |
72 |
[[ ${ret} == 0 ]] || die "Tests failed with ${EPYTHON}" |
73 |
} |
74 |
|
75 |
+src_test() { |
76 |
+ einfo "Starting rabbitmq" |
77 |
+ local -x RABBITMQ_LOG_BASE="${T}/rabbitmq/log" |
78 |
+ local -x RABBITMQ_MNESIA_BASE="${T}/rabbitmq/mnesia" |
79 |
+ local -x RABBITMQ_LOGS="${T}/rabbitmq.log" |
80 |
+ local -x RABBITMQ_PID_FILE="${T}/rabbitmq.pid" |
81 |
+ local -x RABBITMQ_ENABLED_PLUGINS_FILE="${T}/rabbitmq/enabled_plugins" |
82 |
+ /usr/libexec/rabbitmq/rabbitmq-server -p 5672:5672 & |
83 |
+ |
84 |
+ einfo "Waiting for rabbitmq to fully load" |
85 |
+ sleep 10 # Maybe need to increase timeout |
86 |
+ |
87 |
+ distutils-r1_src_test |
88 |
+ |
89 |
+ einfo "Stopping rabbitmq" |
90 |
+ kill "$(<"${RABBITMQ_PID_FILE}")" || die |
91 |
+} |
92 |
+ |
93 |
python_install_all() { |
94 |
local DOCS=( doc/* ) |