Package: python-pecan
Version: 1.3.3-4
Severity: serious
Tags: patch ftbfs
Justification: fails to build from source (but built successfully in the past)
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu jammy ubuntu-patch

Dear Maintainer,

In Ubuntu, the attached patch was applied to fix the build tests when
using python3.10:

  * debian/patches/fix-tests-on-python-3.10.patch: Pull in upstream patch to
    fix build tests on python3.10 (LP: #1965132).

Thanks,
Nick
diff -Nru python-pecan-1.3.3/debian/patches/fix-tests-on-python-3.10.patch 
python-pecan-1.3.3/debian/patches/fix-tests-on-python-3.10.patch
--- python-pecan-1.3.3/debian/patches/fix-tests-on-python-3.10.patch    
1969-12-31 19:00:00.000000000 -0500
+++ python-pecan-1.3.3/debian/patches/fix-tests-on-python-3.10.patch    
2022-03-18 15:41:48.000000000 -0400
@@ -0,0 +1,87 @@
+Description: Fix tests to work on Python 3.10
+Origin: upstream, 
https://github.com/pecan/pecan/pull/131/commits/f189d0eafbaacc5b5093bb8854cd2068e22b6c08
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-pecan/+bug/1965132
+---
+From f189d0eafbaacc5b5093bb8854cd2068e22b6c08 Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evange...@foutrelis.com>
+Date: Wed, 8 Dec 2021 07:01:16 +0200
+Subject: [PATCH] Fix tests to work on Python 3.10
+
+Python 3.10 adds the class name to the exception; adjust four tests
+affected by this change.
+
+Fixes: https://github.com/pecan/pecan/issues/130
+---
+ pecan/tests/test_base.py             | 18 +++++++++++++-----
+ pecan/tests/test_no_thread_locals.py | 20 ++++++++++++++------
+ 2 files changed, 27 insertions(+), 11 deletions(-)
+--- a/pecan/tests/test_base.py
++++ b/pecan/tests/test_base.py
+@@ -456,8 +456,12 @@
+             assert type(ex) == TypeError
+             assert ex.args[0] in (
+                 "index() takes exactly 2 arguments (1 given)",
+-                "index() missing 1 required positional argument: 'id'"
+-            )  # this messaging changed in Python 3.3
++                "index() missing 1 required positional argument: 'id'",
++                (
++                    "TestControllerArguments.app_.<locals>.RootController."
++                    "index() missing 1 required positional argument: 'id'"
++                ),
++            )  # this messaging changed in Python 3.3 and again in Python 3.10
+ 
+     def test_single_argument(self):
+         r = self.app_.get('/1')
+@@ -994,9 +998,13 @@
+         except Exception as ex:
+             assert type(ex) == TypeError
+             assert ex.args[0] in (
+-                "eater() takes at least 2 arguments (1 given)",
+-                "eater() missing 1 required positional argument: 'id'"
+-            )  # this messaging changed in Python 3.3
++                "eater() takes exactly 2 arguments (1 given)",
++                "eater() missing 1 required positional argument: 'id'",
++                (
++                    "TestControllerArguments.app_.<locals>.RootController."
++                    "eater() missing 1 required positional argument: 'id'"
++                ),
++            )  # this messaging changed in Python 3.3 and again in Python 3.10
+ 
+     def test_one_remainder(self):
+         r = self.app_.get('/eater/1')
+--- a/pecan/tests/test_no_thread_locals.py
++++ b/pecan/tests/test_no_thread_locals.py
+@@ -361,9 +361,13 @@
+         except Exception as ex:
+             assert type(ex) == TypeError
+             assert ex.args[0] in (
+-                "index() takes exactly 4 arguments (3 given)",
+-                "index() missing 1 required positional argument: 'id'"
+-            )  # this messaging changed in Python 3.3
++                "index() takes exactly 2 arguments (1 given)",
++                "index() missing 1 required positional argument: 'id'",
++                (
++                    "TestControllerArguments.app_.<locals>.RootController."
++                    "index() missing 1 required positional argument: 'id'"
++                ),
++            )  # this messaging changed in Python 3.3 and again in Python 3.10
+ 
+     def test_single_argument(self):
+         r = self.app_.get('/1')
+@@ -763,9 +767,13 @@
+         except Exception as ex:
+             assert type(ex) == TypeError
+             assert ex.args[0] in (
+-                "eater() takes at least 4 arguments (3 given)",
+-                "eater() missing 1 required positional argument: 'id'"
+-            )  # this messaging changed in Python 3.3
++                "eater() takes exactly 2 arguments (1 given)",
++                "eater() missing 1 required positional argument: 'id'",
++                (
++                    "TestControllerArguments.app_.<locals>.RootController."
++                    "eater() missing 1 required positional argument: 'id'"
++                ),
++            )  # this messaging changed in Python 3.3 and again in Python 3.10
+ 
+     def test_one_remainder(self):
+         r = self.app_.get('/eater/1')
diff -Nru python-pecan-1.3.3/debian/patches/series 
python-pecan-1.3.3/debian/patches/series
--- python-pecan-1.3.3/debian/patches/series    2021-11-12 10:15:53.000000000 
-0500
+++ python-pecan-1.3.3/debian/patches/series    2022-03-15 17:32:59.000000000 
-0400
@@ -1,3 +1,4 @@
 disable-failing-tests.patch
 fix-setup.cfg-for-pytest.patch
 Support_SQLAlchemy_1.4.x.patch
+fix-tests-on-python-3.10.patch

Reply via email to