Date: Wednesday, December 8, 2021 @ 05:04:07 Author: foutrelis Revision: 1065611
Fix tests for Python 3.10 Added: python-pecan/trunk/python310.patch Modified: python-pecan/trunk/PKGBUILD -----------------+ PKGBUILD | 15 ++++++--- python310.patch | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 4 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2021-12-08 04:38:50 UTC (rev 1065610) +++ PKGBUILD 2021-12-08 05:04:07 UTC (rev 1065611) @@ -15,13 +15,20 @@ checkdepends=('python-virtualenv' 'python-jinja' 'gunicorn' 'python-mock' 'python-sqlalchemy' 'python-genshi' 'python-nine' 'uwsgi' 'python-pytest' 'python-kajiki') -source=("${pkgname}-${pkgver}.tar.gz::https://github.com/${_pkgname}/${_pkgname}/archive/${pkgver}.tar.gz") -sha512sums=('3f7e072b294a732af6ff65621b1e10254260b9d42abd2bc38c3bff8e141b2ae4592567075813faf40227e7f0a3f2893c27270926fcfad18d1cdd9dc8a85bd14e') +source=("${pkgname}-${pkgver}.tar.gz::https://github.com/${_pkgname}/${_pkgname}/archive/${pkgver}.tar.gz" + ${pkgname}-sqlalchemy-1.4.patch::https://github.com/pecan/pecan/commit/a520bd544c0b.patch + python310.patch) +sha512sums=('3f7e072b294a732af6ff65621b1e10254260b9d42abd2bc38c3bff8e141b2ae4592567075813faf40227e7f0a3f2893c27270926fcfad18d1cdd9dc8a85bd14e' + 'aa71f0ae65d245afe6038f9765d557764cf8f80eb699e1b52fe71fb502d097f08ef638f11137b9a716f144de4077058a10fd0f2e57f82f8af79608cb63a0b99e' + '6e66a845d701aa63fadd67a8dd644956e7c444690a13fa0eafe6482e959c52318037c053c8fd8df503ffa293129d18858dc63fae6dc316ae3284c6e1753b5864') prepare(){ + cd "${srcdir}/${_pkgname}-${pkgver}" + patch -Np1 -i ../${pkgname}-sqlalchemy-1.4.patch + patch -Np1 -i ../python310.patch # https://github.com/pecan/pecan/pull/131 # fix manpage build - sed -i '/^dist = /d' "${srcdir}/${_pkgname}-${pkgver}/docs/source/conf.py" - sed -i "s/^version = release = .*\$/version = release = '${pkgver}'/" "${srcdir}/${_pkgname}-${pkgver}/docs/source/conf.py" + sed -i '/^dist = /d' docs/source/conf.py + sed -i "s/^version = release = .*\$/version = release = '${pkgver}'/" docs/source/conf.py } build() { Added: python310.patch =================================================================== --- python310.patch (rev 0) +++ python310.patch 2021-12-08 05:04:07 UTC (rev 1065611) @@ -0,0 +1,88 @@ +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(-) + +diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py +index 11d0c4d..62d691e 100644 +--- a/pecan/tests/test_base.py ++++ b/pecan/tests/test_base.py +@@ -456,8 +456,12 @@ class TestControllerArguments(PecanTestCase): + 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 @@ class TestControllerArguments(PecanTestCase): + 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') +diff --git a/pecan/tests/test_no_thread_locals.py b/pecan/tests/test_no_thread_locals.py +index aa8e461..3fbcd88 100644 +--- a/pecan/tests/test_no_thread_locals.py ++++ b/pecan/tests/test_no_thread_locals.py +@@ -361,9 +361,13 @@ class TestControllerArguments(PecanTestCase): + 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 @@ class TestControllerArguments(PecanTestCase): + 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')