commit: 05205acd4714a62ec0a311ff777494f8e1935f73
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 22 09:13:51 2021 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat May 22 09:30:36 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05205acd
dev-python/pgspecial: Start a database server for tests
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/pgspecial/pgspecial-1.13.0.ebuild | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/dev-python/pgspecial/pgspecial-1.13.0.ebuild
b/dev-python/pgspecial/pgspecial-1.13.0.ebuild
index f83f61db75d..9bf3d23fbd6 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
+}