diff --git a/testing/py3-pytest-postgresql/APKBUILD b/testing/py3-pytest-postgresql/APKBUILD new file mode 100644 index 00000000000..e3a0736abf2 --- /dev/null +++ b/testing/py3-pytest-postgresql/APKBUILD @@ -0,0 +1,45 @@ +# Contributor: Antoine Martin (ayakael) +# Maintainer: Antoine Martin (ayakael) +pkgname=py3-pytest-postgresql +_pkgname=pytest-postgresql +pkgver=6.0.0 +pkgrel=0 +pkgdesc="Postgresql fixtures and fixture factories for Pytest." +url="https://pypi.org/project/pytest-postgresql/" +# riscv64: test unit failure due to database system is still starting up +arch="noarch !riscv64" +license="Apache-2.0" +depends="py3-pytest py3-port-for py3-psycopg py3-mirakuru postgresql16" +makedepends="py3-setuptools py3-wheel py3-gpep517" +checkdepends="py3-pytest-cov py3-pytest-xdist" +subpackages="$pkgname-pyc" +source=" + $pkgname-$pkgver.tar.gz::https://github.com/ClearcodeHQ/pytest-postgresql/archive/refs/tags/v$pkgver.tar.gz + parser_set-pgctl-location-to-bin.patch + test_do-not-reimport-plugin.patch + " +builddir="$srcdir"/$_pkgname-$pkgver + +build() { + gpep517 build-wheel \ + --wheel-dir .dist \ + --output-fd 3 3>&1 >&2 +} + +check() { + python3 -m venv --clear --without-pip --system-site-packages .testenv + .testenv/bin/python3 -m installer .dist/*.whl + # tests/docker: requires a working docker daemon + .testenv/bin/python3 -m pytest -v --ignore tests/docker +} + +package() { + gpep517 install-wheel --destdir "$pkgdir" \ + .dist/*.whl +} + +sha512sums=" +4735130bc8d97da96096b3472827053962c9f0e30032330102d5b406443aa10f7ea8ec553176f44b91fc3121c848e10ccb8579a23abcfad8732a1dfabd2fbfb7 py3-pytest-postgresql-6.0.0.tar.gz +d789615c9b4fce2890873815450fb6d98e6dc9e37a0ddc6cd75d2d03dadc60d062ffea966e9ca0376655d7785e309ba4d3a73f01276fc7c4f8c58f145eb45ea8 parser_set-pgctl-location-to-bin.patch +553ba894d2828ab9f48e81cb4717c8ceda83409b7d397551192068e5f4261ec15fa3bacc25a319c41a2ee8a8baebd35f55b3d8e9ae1556cd073cee3e7a536e8b test_do-not-reimport-plugin.patch +" diff --git a/testing/py3-pytest-postgresql/parser_set-pgctl-location-to-bin.patch b/testing/py3-pytest-postgresql/parser_set-pgctl-location-to-bin.patch new file mode 100644 index 00000000000..33f4fef1792 --- /dev/null +++ b/testing/py3-pytest-postgresql/parser_set-pgctl-location-to-bin.patch @@ -0,0 +1,13 @@ +diff --git a/pytest_postgresql/plugin.py.orig b/pytest_postgresql/plugin.py +index d4e0a1d90ee..7e66df278bb 100644 +--- a/pytest_postgresql/plugin.py.orig ++++ b/pytest_postgresql/plugin.py +@@ -38,7 +38,7 @@ _help_postgres_options = "Postgres executable extra parameters. Passed via the - + def pytest_addoption(parser: Parser) -> None: + """Configure options for pytest-postgresql.""" + parser.addini( +- name="postgresql_exec", help=_help_executable, default="/usr/lib/postgresql/13/bin/pg_ctl" ++ name="postgresql_exec", help=_help_executable, default="/usr/bin/pg_ctl" + ) + + parser.addini(name="postgresql_host", help=_help_host, default="127.0.0.1") diff --git a/testing/py3-pytest-postgresql/test_do-not-reimport-plugin.patch b/testing/py3-pytest-postgresql/test_do-not-reimport-plugin.patch new file mode 100644 index 00000000000..713c6ef94fd --- /dev/null +++ b/testing/py3-pytest-postgresql/test_do-not-reimport-plugin.patch @@ -0,0 +1,24 @@ +diff --git a/tests/test_postgres_options_plugin.py.orig b/tests/test_postgres_options_plugin.py +index 6a8bca8f4d7..a39e475b589 100644 +--- a/tests/test_postgres_options_plugin.py.orig ++++ b/tests/test_postgres_options_plugin.py +@@ -14,7 +14,6 @@ def pointed_pytester(pytester: Pytester) -> Pytester: + pytest_postgresql_path = Path(pytest_postgresql.__file__) + root_path = pytest_postgresql_path.parent.parent + pytester.syspathinsert(root_path) +- pytester.makeconftest("from pytest_postgresql.plugin import *\n") + return pytester + + +diff --git a/tests/conftest.py.orig b/tests/conftest.py +index a75e526eb23..76547c6213e 100644 +--- a/tests/conftest.py.orig ++++ b/tests/conftest.py +@@ -4,7 +4,6 @@ import os + from pathlib import Path + + from pytest_postgresql import factories +-from pytest_postgresql.plugin import * # noqa: F403,F401 + + pytest_plugins = ["pytester"] + POSTGRESQL_VERSION = os.environ.get("POSTGRES", "13")