diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2021-10-15 08:35:06 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2021-10-15 08:38:56 +0300 |
commit | d2e3ddd7dce26b035a3e18cbdfa2f0f33bca1262 (patch) | |
tree | 69624861506411047348fc2087ffef2852808718 /dev-python/txAMQP | |
parent | net-dns/avahi: enable py3.10 (diff) | |
download | gentoo-d2e3ddd7dce26b035a3e18cbdfa2f0f33bca1262.tar.gz gentoo-d2e3ddd7dce26b035a3e18cbdfa2f0f33bca1262.tar.bz2 gentoo-d2e3ddd7dce26b035a3e18cbdfa2f0f33bca1262.zip |
dev-python/txAMQP: enable py3.10, enable tests
Enable tests by spawning tabbitmq local server and running the tests
over it. The tests server should be fully isolated and run inside
${T} directory.
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-python/txAMQP')
-rw-r--r-- | dev-python/txAMQP/txAMQP-0.8.2.ebuild | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/dev-python/txAMQP/txAMQP-0.8.2.ebuild b/dev-python/txAMQP/txAMQP-0.8.2.ebuild index 31f1d27c9d08..ee0ea7c19f33 100644 --- a/dev-python/txAMQP/txAMQP-0.8.2.ebuild +++ b/dev-python/txAMQP/txAMQP-0.8.2.ebuild @@ -3,23 +3,25 @@ EAPI=7 -PYTHON_COMPAT=( python3_{7..9} ) +PYTHON_COMPAT=( python3_{8..10} ) PYTHON_REQ_USE="xml(+)" inherit distutils-r1 -MY_P=${PN,,}-${PV} +MY_P="${PN,,}-${PV}" + DESCRIPTION="Python library for communicating with AMQP peers using Twisted" HOMEPAGE="https://github.com/txamqp/txamqp" # pypi tarball misses doc files # https://github.com/txamqp/txamqp/pull/10 SRC_URI="https://github.com/txamqp/txamqp/archive/${PV}.tar.gz -> ${MY_P}.tar.gz" -S=${WORKDIR}/${MY_P} +S="${WORKDIR}/${MY_P}" LICENSE="Apache-2.0" -KEYWORDS="~amd64 ~x86 ~x64-solaris" SLOT="0" +KEYWORDS="~amd64 ~x86 ~x64-solaris" IUSE="test" +RESTRICT="!test? ( test )" RDEPEND=" dev-python/twisted[${PYTHON_USEDEP}] @@ -31,16 +33,12 @@ BDEPEND=" net-misc/rabbitmq-server )" -# Tests connect to the system rabbitmq server -# TODO: figure out how to start an isolated instance -RESTRICT="test" - python_test() { cd src || die # tests look for those files relatively to modules cp -r specs "${BUILD_DIR}"/lib || die - TXAMQP_BROKER=RABBITMQ trial txamqp + TXAMQP_BROKER=RABBITMQ "${EPYTHON}" -m twisted.trial txamqp local ret=${?} # avoid installing spec files @@ -49,6 +47,24 @@ python_test() { [[ ${ret} == 0 ]] || die "Tests failed with ${EPYTHON}" } +src_test() { + einfo "Starting rabbitmq" + local -x RABBITMQ_LOG_BASE="${T}/rabbitmq/log" + local -x RABBITMQ_MNESIA_BASE="${T}/rabbitmq/mnesia" + local -x RABBITMQ_LOGS="${T}/rabbitmq.log" + local -x RABBITMQ_PID_FILE="${T}/rabbitmq.pid" + local -x RABBITMQ_ENABLED_PLUGINS_FILE="${T}/rabbitmq/enabled_plugins" + /usr/libexec/rabbitmq/rabbitmq-server -p 5672:5672 & + + einfo "Waiting for rabbitmq to fully load" + sleep 10 # Maybe need to increase timeout + + distutils-r1_src_test + + einfo "Stopping rabbitmq" + kill "$(<"${RABBITMQ_PID_FILE}")" || die +} + python_install_all() { local DOCS=( doc/* ) |