public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/mongoengine/
Date: Tue, 13 Apr 2021 13:29:08 +0000 (UTC)	[thread overview]
Message-ID: <1618320545.c7717708c0eb326a6fffafb90f08f4ea07616463.mgorny@gentoo> (raw)

commit:     c7717708c0eb326a6fffafb90f08f4ea07616463
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 13 13:28:57 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Apr 13 13:29:05 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7717708

dev-python/mongoengine: Run local mongodb instance for testing

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/mongoengine/mongoengine-0.23.0.ebuild | 37 ++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/dev-python/mongoengine/mongoengine-0.23.0.ebuild b/dev-python/mongoengine/mongoengine-0.23.0.ebuild
index d6ca245f7e8..70ccf79efec 100644
--- a/dev-python/mongoengine/mongoengine-0.23.0.ebuild
+++ b/dev-python/mongoengine/mongoengine-0.23.0.ebuild
@@ -13,8 +13,6 @@ SRC_URI="https://github.com/MongoEngine/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-# TODO: make it run a local database server
-RESTRICT="test"
 
 RDEPEND="dev-python/blinker[${PYTHON_USEDEP}]
 	dev-python/pillow[${PYTHON_USEDEP}]
@@ -42,3 +40,38 @@ src_prepare() {
 
 	distutils-r1_src_prepare
 }
+
+python_test() {
+	local dbpath=${TMPDIR}/mongo.db
+	local logpath=${TMPDIR}/mongod.log
+
+	mkdir -p "${dbpath}" || die
+	ebegin "Trying to start mongod on port ${DB_PORT}"
+
+	LC_ALL=C \
+	mongod --dbpath "${dbpath}" --nojournal \
+		--bind_ip 127.0.0.1 --port 27017 \
+		--unixSocketPrefix "${TMPDIR}" \
+		--logpath "${logpath}" --fork || die
+	sleep 2
+
+	# Now we need to check if the server actually started...
+	if [[ -S "${TMPDIR}"/mongodb-27017.sock ]]; then
+		# yay!
+		eend 0
+	else
+		eend 1
+		eerror "Unable to start mongod for tests. See the server log:"
+		eerror "	${logpath}"
+		die "Unable to start mongod for tests."
+	fi
+
+	local failed
+	nonfatal epytest || failed=1
+
+	mongod --dbpath "${dbpath}" --shutdown || die
+
+	[[ ${failed} ]] && die "Tests fail with ${EPYTHON}"
+
+	rm -rf "${dbpath}" || die
+}


             reply	other threads:[~2021-04-13 13:29 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 13:29 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-02 11:39 [gentoo-commits] repo/gentoo:master commit in: dev-python/mongoengine/ Arthur Zamarin
2021-06-06 14:46 Michał Górny
2021-06-06 13:01 Sam James
2021-05-04 13:59 Michał Górny
2021-04-29 10:21 Michał Górny
2021-04-29 10:09 Michał Górny
2021-04-13 21:49 Michał Górny
2021-04-13 21:49 Michał Górny
2021-04-13 13:14 Michał Górny
2021-03-05 10:14 Michał Górny
2021-01-19  8:02 Michał Górny
2021-01-19  2:45 Sam James
2020-12-21 20:31 Michał Górny
2020-12-21 20:25 Sam James
2020-12-21 19:43 Michał Górny
2020-12-16 23:04 Michał Górny
2020-12-15 11:05 Michał Górny
2020-11-20  9:54 Michał Górny
2020-09-18 15:30 Michał Górny
2020-08-30  1:32 Thomas Deutschmann
2020-08-25 12:53 Agostino Sarubbo
2020-07-02 12:42 Michał Górny
2020-02-05 21:28 Andreas Sturmlechner
2019-12-01 19:27 Andreas Sturmlechner
2018-01-05  9:36 Michał Górny
2017-12-29 18:48 Mikle Kolyada
2017-05-15 13:49 Manuel Rüger
2016-06-09 10:12 Tiziano Müller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1618320545.c7717708c0eb326a6fffafb90f08f4ea07616463.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox