diff options
author | Michał Górny <mgorny@gentoo.org> | 2021-05-22 11:13:51 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2021-05-22 11:30:36 +0200 |
commit | 05205acd4714a62ec0a311ff777494f8e1935f73 (patch) | |
tree | c570b0d8f8efbeac48b85c9a54aa0c926c483277 /dev-python/pgspecial | |
parent | dev-util/android-sdk-update-manager: swt:4.10 slot update (diff) | |
download | gentoo-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.ebuild | 18 |
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 +} |