summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-06-24 11:07:23 +0200
committerMichał Górny <mgorny@gentoo.org>2023-06-24 13:32:13 +0200
commit20230490139219be66382115c9f1d0b614d8dad7 (patch)
tree16e9dbbbaa3986765cfee9a9b667aade3bd41d3d
parentdev-python/pymongo: Remove unused DB_PORT{2,3} vars (diff)
downloadgentoo-20230490139219be66382115c9f1d0b614d8dad7.tar.gz
gentoo-20230490139219be66382115c9f1d0b614d8dad7.tar.bz2
gentoo-20230490139219be66382115c9f1d0b614d8dad7.zip
dev-python/pymongo: Support running the test suite without mongodb
Add IUSE=test-full and support running the test suite without a running mongodb server when it is disabled. This makes it possible to keyword pymongo on architectures where the low quality mongodb software does not build. Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--dev-python/pymongo/metadata.xml6
-rw-r--r--dev-python/pymongo/pymongo-4.4.0.ebuild21
2 files changed, 19 insertions, 8 deletions
diff --git a/dev-python/pymongo/metadata.xml b/dev-python/pymongo/metadata.xml
index 9fefebbe96bd..49d5ee837cb8 100644
--- a/dev-python/pymongo/metadata.xml
+++ b/dev-python/pymongo/metadata.xml
@@ -12,6 +12,12 @@
<longdescription lang="en">PyMongo is a Python distribution containing tools
for working with MongoDB, and is the recommended way to work
with MongoDB from Python.</longdescription>
+ <use>
+ <flag name="test-full">
+ Run test suite in full, including tests that run a local
+ database instance.
+ </flag>
+ </use>
<upstream>
<remote-id type="pypi">pymongo</remote-id>
<remote-id type="github">mongodb/mongo-python-driver</remote-id>
diff --git a/dev-python/pymongo/pymongo-4.4.0.ebuild b/dev-python/pymongo/pymongo-4.4.0.ebuild
index e39037ff6b3b..39b138a7bd5f 100644
--- a/dev-python/pymongo/pymongo-4.4.0.ebuild
+++ b/dev-python/pymongo/pymongo-4.4.0.ebuild
@@ -24,14 +24,14 @@ S=${WORKDIR}/${MY_P}
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~hppa ~riscv ~x86"
-IUSE="doc kerberos"
+IUSE="doc kerberos +test-full"
RDEPEND="
<dev-python/dnspython-3.0.0[${PYTHON_USEDEP}]
kerberos? ( dev-python/pykerberos[${PYTHON_USEDEP}] )
"
BDEPEND="
- test? (
+ test-full? (
>=dev-db/mongodb-2.6.0
)
"
@@ -40,7 +40,7 @@ distutils_enable_sphinx doc
distutils_enable_tests unittest
reqcheck() {
- if use test; then
+ if use test-full; then
# During the tests, database size reaches 1.5G.
local CHECKREQS_DISK_BUILD=1536M
@@ -72,11 +72,16 @@ src_prepare() {
}
python_test() {
- # Yes, we need TCP/IP for that...
- local DB_IP=127.0.0.1
- local DB_PORT=27000
+ if ! use test-full; then
+ # .invalid is guaranteed to return NXDOMAIN per RFC 6761
+ local -x DB_IP=mongodb.invalid
+ esetup.py test
+ return
+ fi
- export DB_IP DB_PORT
+ # Yes, we need TCP/IP for that...
+ local -x DB_IP=127.0.0.1
+ local -x DB_PORT=27000
local dbpath=${TMPDIR}/mongo.db
local logpath=${TMPDIR}/mongod.log
@@ -116,7 +121,7 @@ python_test() {
done
local failed
- esetup.py test || failed=1
+ nonfatal esetup.py test || failed=1
mongod --dbpath "${dbpath}" --shutdown || die