diff --git a/debian/changelog b/debian/changelog index 480d7e5..3189b42 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,23 +1,29 @@ +pytest-postgresql (3.1.3~gh-1~~swh1) unstable-swh; urgency=medium + + * New upstream release (from github) + + -- David Douard Thu, 17 Feb 2022 17:05:12 +0100 + pytest-postgresql (2.2.0-2~~swh1) unstable-swh; urgency=medium * Remove .coverage from installed directory -- Nicolas Dandrimont Wed, 23 Oct 2019 17:25:05 +0200 pytest-postgresql (2.2.0-1~~swh1) unstable-swh; urgency=medium * New upstream release -- Nicolas Dandrimont Wed, 23 Oct 2019 14:59:13 +0200 pytest-postgresql (1.3.4-1+swh2) unstable-swh; urgency=medium * Update missing runtime dependencies -- Antoine R. Dumont (@ardumont) Sat, 09 Feb 2019 21:27:14 +0100 pytest-postgresql (1.3.4-1+swh1) unstable-swh; urgency=medium * Initial release -- Antoine R. Dumont (@ardumont) Fri, 08 Feb 2019 16:05:10 +0100 diff --git a/debian/control b/debian/control index 0b5ee60..4a15f75 100644 --- a/debian/control +++ b/debian/control @@ -1,31 +1,32 @@ Source: pytest-postgresql Priority: optional Section: python Maintainer: SoftwareHeritage Developers Build-Depends: debhelper (>= 11), dh-python (>= 2), + locales, postgresql, python3-all, - python3-mirakuru (>= 2), + python3-mirakuru (>= 2.4), python3-pip, python3-port-for, python3-psycopg2, python3-pytest, python3-pytest-cov, python3-pytest-xdist, python3-setuptools Standards-Version: 4.1.3 Homepage: https://github.com/ClearcodeHQ/pytest-postgresql Package: python3-pytest-postgresql Architecture: all Depends: postgresql, python3-mirakuru, python3-port-for, python3-pytest, ${misc:Depends}, ${python3:Depends} Description: PostgreSQL fixtures and fixture factories for Pytest This is a pytest plugin, that enables you to test your code that relies on a running PostgreSQL Database. It allows you to specify fixtures for PostgreSQL process and client. diff --git a/debian/patches/0001-Use-usr-lib-postgresql-as-search-path-for-pg_ctl.patch b/debian/patches/0001-Use-usr-lib-postgresql-as-search-path-for-pg_ctl.patch index e4f9641..0ff03ef 100644 --- a/debian/patches/0001-Use-usr-lib-postgresql-as-search-path-for-pg_ctl.patch +++ b/debian/patches/0001-Use-usr-lib-postgresql-as-search-path-for-pg_ctl.patch @@ -1,60 +1,59 @@ From: Nicolas Dandrimont Date: Wed, 23 Oct 2019 15:10:30 +0200 Subject: Use /usr/lib/postgresql as search path for pg_ctl --- src/pytest_postgresql/factories.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) -diff --git a/src/pytest_postgresql/factories.py b/src/pytest_postgresql/factories.py -index e861f2d..bc147ca 100644 ---- a/src/pytest_postgresql/factories.py -+++ b/src/pytest_postgresql/factories.py -@@ -17,9 +17,9 @@ +Index: python3-pytest-postgresql/src/pytest_postgresql/factories/process.py +=================================================================== +--- python3-pytest-postgresql.orig/src/pytest_postgresql/factories/process.py ++++ python3-pytest-postgresql/src/pytest_postgresql/factories/process.py +@@ -16,9 +16,9 @@ + # You should have received a copy of the GNU Lesser General Public License # along with pytest-dbfixtures. If not, see . - """Fixture factories for postgresql fixtures.""" - + """Fixture factory for postgresql process.""" +import glob import os.path import platform -import subprocess - from tempfile import gettempdir + from typing import Union, Callable, List, Iterator, Optional, Tuple, Set from warnings import warn -@@ -148,6 +148,18 @@ def postgresql_proc( - :rtype: func +@@ -81,6 +81,17 @@ def postgresql_proc( :returns: function which makes a postgresql process """ -+ + + def get_postgresql_dirs(): + base = '/usr/lib/postgresql' + dirs = glob.glob(os.path.join(base, '[0-9]*')) + + def sort_key(d): + dirname = os.path.basename(d) + return tuple(map(int, dirname.split('.'))) + + dirs.sort(key=sort_key) + return dirs + - @pytest.fixture(scope='session') - def postgresql_proc_fixture(request, tmpdir_factory): - """ -@@ -162,10 +174,13 @@ def postgresql_proc( + @pytest.fixture(scope="session") + def postgresql_proc_fixture( + request: FixtureRequest, tmp_path_factory: TempPathFactory +@@ -101,10 +112,13 @@ def postgresql_proc( # check if that executable exists, as it's no on system PATH # only replace if executable isn't passed manually if not os.path.exists(postgresql_ctl) and executable is None: - pg_bindir = subprocess.check_output( -- ['pg_config', '--bindir'], universal_newlines=True +- ["pg_config", "--bindir"], universal_newlines=True - ).strip() -- postgresql_ctl = os.path.join(pg_bindir, 'pg_ctl') +- postgresql_ctl = os.path.join(pg_bindir, "pg_ctl") + for pg_basedir in get_postgresql_dirs(): + pg_bindir = os.path.join(pg_basedir, 'bin') + postgresql_ctl = os.path.join(pg_bindir, 'pg_ctl') + if os.path.exists(postgresql_ctl): + break + else: + raise ValueError('No pg_ctl installation found.') - pg_host = host or config['host'] - pg_port = get_port(port) or get_port(config['port']) + tmpdir = tmp_path_factory.mktemp(f"pytest-postgresql-{request.fixturename}") + diff --git a/debian/patches/0002-Mark-more-postgresql-executable-tests-as-xfail.patch b/debian/patches/0002-Mark-more-postgresql-executable-tests-as-xfail.patch index a4bdb71..2bfdeb2 100644 --- a/debian/patches/0002-Mark-more-postgresql-executable-tests-as-xfail.patch +++ b/debian/patches/0002-Mark-more-postgresql-executable-tests-as-xfail.patch @@ -1,38 +1,19 @@ From: Nicolas Dandrimont Date: Wed, 23 Oct 2019 16:52:39 +0200 Subject: Mark more postgresql executable tests as xfail --- pytest.ini | 2 +- tests/test_postgresql.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) -diff --git a/pytest.ini b/pytest.ini -index 143010f..e381f90 100644 ---- a/pytest.ini -+++ b/pytest.ini -@@ -2,4 +2,4 @@ - addopts = --max-slave-restart=0 --showlocals --verbose --cov src/pytest_postgresql --cov tests - postgresql_exec = /usr/lib/postgresql/10/bin/pg_ctl +--- a/setup.cfg ++++ b/setup.cfg +@@ -64,6 +64,6 @@ match = '(?!docs|build|venv).*\.py' + [tool:pytest] + addopts = --max-worker-restart=0 --showlocals --verbose --cov src/pytest_postgresql --cov tests testpaths = tests -xfail_strict = true +xfail_strict = false -diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py -index 83f33b8..6c8fbee 100644 ---- a/tests/test_postgresql.py -+++ b/tests/test_postgresql.py -@@ -12,10 +12,10 @@ QUERY = "CREATE TABLE test (id serial PRIMARY KEY, num integer, data varchar);" - reason='These fixtures are only for linux' - ) - @pytest.mark.parametrize('postgres', ( -- 'postgresql94', -- 'postgresql95', -- 'postgresql96', -- 'postgresql10', -+ pytest.param('postgresql94', marks=pytest.mark.xfail), -+ pytest.param('postgresql95', marks=pytest.mark.xfail), -+ pytest.param('postgresql96', marks=pytest.mark.xfail), -+ pytest.param('postgresql10', marks=pytest.mark.xfail), - pytest.param('postgresql11', marks=pytest.mark.xfail), - )) - def test_postgresql_proc(request, postgres): + pytester_example_dir = tests/examples + norecursedirs=examples diff --git a/debian/rules b/debian/rules index 940569c..1d55616 100755 --- a/debian/rules +++ b/debian/rules @@ -1,13 +1,25 @@ #!/usr/bin/make -f export PYBUILD_NAME=pytest-postgresql -export PYBUILD_TEST_ARGS=-p pytest_postgresql.plugin +export PYBUILD_TEST_ARGS=-p pytest_postgresql.plugin \ + --ignore-glob=*docker* \ + --ignore=tests/test_postgres_options_plugin.py \ + --postgresql-exec=`find /usr/lib/postgresql/*/bin/pg_ctl | head -n 1` %: dh $@ --with python3 --buildsystem=pybuild + +override_dh_auto_test: + mkdir -p debian/tmp/locale/ + localedef -f UTF-8 -i en_US ./debian/tmp/locale/en_US.UTF-8/ + localedef -f UTF-8 -i de_DE ./debian/tmp/locale/de_DE.UTF-8/ + export LOCPATH=$(CURDIR)/debian/tmp/locale/ && \ + export LC_ALL=en_US.UTF-8 && \ + dh_auto_test + + override_dh_auto_install: dh_auto_install rm -r $(CURDIR)/debian/*/usr/lib/python3.*/dist-packages/.coverage - rm -r $(CURDIR)/debian/*/usr/lib/python3.*/dist-packages/.pytest_cache