commit: 4e9f07946a0f4dad151d38fe3089130c88c9c344
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 12 10:24:13 2020 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun 12 10:59:03 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e9f0794
dev-python/psycopg: Enable tests
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/psycopg/psycopg-2.8.4.ebuild | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/dev-python/psycopg/psycopg-2.8.4.ebuild
b/dev-python/psycopg/psycopg-2.8.4.ebuild
index f5b41a2bfa7..76f4141a292 100644
--- a/dev-python/psycopg/psycopg-2.8.4.ebuild
+++ b/dev-python/psycopg/psycopg-2.8.4.ebuild
@@ -13,6 +13,7 @@ MY_P="${MY_PN}-${PV}"
DESCRIPTION="PostgreSQL database adapter for Python"
HOMEPAGE="http://initd.org/psycopg/ https://pypi.org/project/psycopg2/"
SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
+S=${WORKDIR}/${MY_P}
LICENSE="LGPL-3+"
SLOT="2"
@@ -26,15 +27,11 @@ DEPEND="${RDEPEND}
>=dev-python/sphinx-1.6
)"
-RESTRICT="test"
-
# Avoid using mxdatetime: https://bugs.gentoo.org/452028
PATCHES=(
"${FILESDIR}"/psycopg-2.8.3-avoid-mxdatetime.patch
)
-S="${WORKDIR}/${MY_P}"
-
python_compile() {
local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}
@@ -55,6 +52,26 @@ python_compile_all() {
use doc && emake -C doc/src -j1 html text
}
+src_test() {
+ initdb -D "${T}"/pgsql || die
+ # TODO: random port
+ pg_ctl -w -D "${T}"/pgsql start \
+ -o "-h '' -k '${T}'" || die
+ createdb -h "${T}" psycopg2_test || die
+
+ local -x PSYCOPG2_TESTDB_HOST="${T}"
+ distutils-r1_src_test
+
+ pg_ctl -w -D "${T}"/pgsql stop || die
+}
+
+python_test() {
+ "${EPYTHON}" -c "
+import tests
+tests.unittest.main(defaultTest='tests.test_suite')
+" --verbose || die "Tests fail with ${EPYTHON}"
+}
+
python_install_all() {
if use doc; then
dodoc -r doc/src/_build/html