summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-05-22 11:13:51 +0200
committerMichał Górny <mgorny@gentoo.org>2021-05-22 11:30:36 +0200
commit05205acd4714a62ec0a311ff777494f8e1935f73 (patch)
treec570b0d8f8efbeac48b85c9a54aa0c926c483277 /dev-python/pgspecial
parentdev-util/android-sdk-update-manager: swt:4.10 slot update (diff)
downloadgentoo-05205acd4714a62ec0a311ff777494f8e1935f73.tar.gz
gentoo-05205acd4714a62ec0a311ff777494f8e1935f73.tar.bz2
gentoo-05205acd4714a62ec0a311ff777494f8e1935f73.zip
dev-python/pgspecial: Start a database server for tests
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/pgspecial')
-rw-r--r--dev-python/pgspecial/pgspecial-1.13.0.ebuild18
1 files changed, 18 insertions, 0 deletions
diff --git a/dev-python/pgspecial/pgspecial-1.13.0.ebuild b/dev-python/pgspecial/pgspecial-1.13.0.ebuild
index f83f61db75dc..9bf3d23fbd6f 100644
--- a/dev-python/pgspecial/pgspecial-1.13.0.ebuild
+++ b/dev-python/pgspecial/pgspecial-1.13.0.ebuild
@@ -20,6 +20,24 @@ RDEPEND="
>=dev-python/psycopg-2.7.4[${PYTHON_USEDEP}]
>=dev-python/sqlparse-0.1.19[${PYTHON_USEDEP}]
"
+BDEPEND="
+ test? ( >=dev-db/postgresql-8.1[server] )"
distutils_enable_tests pytest
DOCS=( License.txt README.rst changelog.rst )
+
+src_test() {
+ local db=${T}/pgsql
+
+ initdb --username=postgres -D "${db}" || die
+ # TODO: random port
+ pg_ctl -w -D "${db}" start \
+ -o "-h '127.0.0.1' -p 5432 -k '${T}'" || die
+ psql -h "${T}" -U postgres -d postgres \
+ -c "ALTER ROLE postgres WITH PASSWORD 'postgres';" || die
+ createdb -h "${T}" -U postgres _test_db || die
+
+ distutils-r1_src_test
+
+ pg_ctl -w -D "${db}" stop || die
+}