From 428325d9f600befcb018f63c99252c4e3516c09f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sloup?= Date: Tue, 17 May 2022 12:50:17 +0200 Subject: [PATCH] Successful rebase to 2.9.3 Make documentation Remove failing test 'test_from_tables()' from ./tests/test_types_extras.py failing on s390 --- python-psycopg2.spec | 29 ++++++++-- ..._types_extras-2.9.3-test_from_tables.patch | 54 +++++++++++++++++++ 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 test_types_extras-2.9.3-test_from_tables.patch diff --git a/python-psycopg2.spec b/python-psycopg2.spec index f45127e..4f0a583 100644 --- a/python-psycopg2.spec +++ b/python-psycopg2.spec @@ -50,7 +50,7 @@ features offered by PostgreSQL. Summary: %{sum} Name: python-%{srcname} Version: 2.9.3 -Release: 2%{?dist} +Release: 3%{?dist} # The exceptions allow linking to OpenSSL and PostgreSQL's libpq License: LGPLv3+ with exceptions Url: http://initd.org/psycopg/ @@ -64,6 +64,7 @@ Source0: http://initd.org/psycopg/tarballs/PSYCOPG-2-8/psycopg2-%{version}.tar.g BuildRequires: gcc BuildRequires: pkgconfig(libpq) +BuildRequires: python-sphinx # For testsuite %if %{with tests} @@ -72,6 +73,10 @@ BuildRequires: postgresql-test-rpm-macros Conflicts: python-psycopg2-zope < %{version} +# Remove test 'test_from_tables' for s390 architecture +# from ./tests/test_types_extras.py +Patch0: test_types_extras-2.9.3-test_from_tables.patch + %description %{desc} @@ -163,8 +168,13 @@ Zope Database Adapter for PostgreSQL, called ZPsycopgDA %prep -%autosetup -p1 -n psycopg2-%{version} +%setup -q -n psycopg2-%{version} +# The patch is applied only for s390 architecture as +# on other architectures the test works +%ifarch s390x s390 +%patch0 -p0 +%endif %build export CFLAGS=${RPM_OPT_FLAGS} LDFLAGS=${RPM_LD_FLAGS} @@ -181,7 +191,13 @@ for i in `find doc -iname "*.css"`; do sed -i 's/\r//' $i; done # We can not build docs now: # https://www.postgresql.org/message-id/2741387.dvL6Cb0VMB@nb.usersys.redhat.com -# make -C doc/src html +# as the bug was sorted, we can build the documentation again + +# Remove design formatting package +sed -i '/better_theme_path/d' doc/src/conf.py +sed -i "/html_theme = 'better'/d" doc/src/conf.py + +make html -C doc/src %check @@ -279,7 +295,7 @@ done %files doc %license LICENSE -%doc doc +%doc doc/src/_build/html %if %zope @@ -295,6 +311,11 @@ done %changelog +* Fri May 13 2022 Ondrej Sloup - 2.9.3-3 +- Remove test test_from_tables failing on s390x +- Make docs +- Pray that Friday the 13th will not break anything + * Fri Jan 21 2022 Fedora Release Engineering - 2.9.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/test_types_extras-2.9.3-test_from_tables.patch b/test_types_extras-2.9.3-test_from_tables.patch new file mode 100644 index 0000000..750e479 --- /dev/null +++ b/test_types_extras-2.9.3-test_from_tables.patch @@ -0,0 +1,54 @@ +--- tests/test_types_extras.py-orig 2021-12-29 13:51:56.000000000 +0100 ++++ tests/test_types_extras.py 2022-05-17 11:23:12.476001589 +0200 +@@ -616,51 +616,6 @@ + curs.execute("select (1,2)::type_ii") + self.assertRaises(psycopg2.DataError, curs.fetchone) + +- @slow +- @skip_if_no_composite +- @skip_before_postgres(8, 4) +- def test_from_tables(self): +- curs = self.conn.cursor() +- curs.execute("""create table ctest1 ( +- id integer primary key, +- temp int, +- label varchar +- );""") +- +- curs.execute("""alter table ctest1 drop temp;""") +- +- curs.execute("""create table ctest2 ( +- id serial primary key, +- label varchar, +- test_id integer references ctest1(id) +- );""") +- +- curs.execute("""insert into ctest1 (id, label) values +- (1, 'test1'), +- (2, 'test2');""") +- curs.execute("""insert into ctest2 (label, test_id) values +- ('testa', 1), +- ('testb', 1), +- ('testc', 2), +- ('testd', 2);""") +- +- psycopg2.extras.register_composite("ctest1", curs) +- psycopg2.extras.register_composite("ctest2", curs) +- +- curs.execute(""" +- select ctest1, array_agg(ctest2) as test2s +- from ( +- select ctest1, ctest2 +- from ctest1 inner join ctest2 on ctest1.id = ctest2.test_id +- order by ctest1.id, ctest2.label +- ) x group by ctest1;""") +- +- r = curs.fetchone() +- self.assertEqual(r[0], (1, 'test1')) +- self.assertEqual(r[1], [(1, 'testa', 1), (2, 'testb', 1)]) +- r = curs.fetchone() +- self.assertEqual(r[0], (2, 'test2')) +- self.assertEqual(r[1], [(3, 'testc', 2), (4, 'testd', 2)]) + + @skip_if_no_composite + def test_non_dbapi_connection(self):