[arch-commits] Commit in python-pytest-benchmark/trunk (PKGBUILD python310.patch)

Evangelos Foutras foutrelis at gemini.archlinux.org
Tue Dec 7 14:06:11 UTC 2021


    Date: Tuesday, December 7, 2021 @ 14:06:11
  Author: foutrelis
Revision: 1065542

Add test fix for Python 3.10

Added:
  python-pytest-benchmark/trunk/python310.patch
Modified:
  python-pytest-benchmark/trunk/PKGBUILD

-----------------+
 PKGBUILD        |    9 ++++++-
 python310.patch |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+), 2 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-12-07 13:31:21 UTC (rev 1065541)
+++ PKGBUILD	2021-12-07 14:06:11 UTC (rev 1065542)
@@ -11,12 +11,17 @@
 makedepends=('python-setuptools')
 checkdepends=('python-pygal' 'python-freezegun' 'mercurial' 'python-aspectlib'
               'python-pytest-xdist' 'python-elasticsearch' 'git')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/ionelmc/pytest-benchmark/archive/v$pkgver.tar.gz")
-sha512sums=('54fb5e3a176578b3c8f339878c7a9d047a0785befcbba42bb68c34b4b636d9b6f6a2097b36c5eefbbcf1a91f943bdae762c7978a0dba1af53514052f513ef4c5')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/ionelmc/pytest-benchmark/archive/v$pkgver.tar.gz"
+        python310.patch)
+sha512sums=('54fb5e3a176578b3c8f339878c7a9d047a0785befcbba42bb68c34b4b636d9b6f6a2097b36c5eefbbcf1a91f943bdae762c7978a0dba1af53514052f513ef4c5'
+            '8f1c062bc502ea8ec0421509576bc1042354a5bc49f918ff7ceb8360387405f1897b1b79a1700d5ed506c326214a6222fc41353f68eeb72e37914e27ed30b1aa')
 
 prepare() {
   cd pytest-benchmark-$pkgver
   sed -i 's/\[glob_or_file ...]]/...]/' tests/test_cli.py
+
+  # https://github.com/ionelmc/pytest-benchmark/pull/210
+  patch -Np1 -i ../python310.patch
 }
 
 build() {

Added: python310.patch
===================================================================
--- python310.patch	                        (rev 0)
+++ python310.patch	2021-12-07 14:06:11 UTC (rev 1065542)
@@ -0,0 +1,62 @@
+From b8c7d662f7b58ce48124c69082acf48acd0539bb Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evangelos at foutrelis.com>
+Date: Tue, 7 Dec 2021 15:55:02 +0200
+Subject: [PATCH] Fix test_cli.py::test_help* to work on Python 3.10
+
+From Python 3.10 release notes:
+
+Misleading phrase "optional arguments" was replaced with "options" in
+argparse help. Some tests might require adaptation if they rely on exact
+output match. (Contributed by Raymond Hettinger in bpo-9694.)
+---
+ tests/test_cli.py | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index c71ef22..be082ad 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -9,6 +9,7 @@ pytest_plugins = 'pytester',
+ 
+ THIS = py.path.local(__file__)
+ STORAGE = THIS.dirpath('test_storage')
++OPTIONS = 'options' if sys.version_info >= (3, 10) else 'optional arguments'
+ 
+ 
+ @pytest.fixture
+@@ -26,7 +27,7 @@ def test_help(testdir):
+         "",
+         "pytest_benchmark's management commands.",
+         "",
+-        "optional arguments:",
++        "%s:" % OPTIONS,
+         "  -h [COMMAND], --help [COMMAND]",
+         "                        Display help and exit.",
+         "  --storage URI, -s URI",
+@@ -57,7 +58,7 @@ def test_help_command(testdir):
+         'positional arguments:',
+         '  command',
+         '',
+-        'optional arguments:',
++        '%s:' % OPTIONS,
+         '  -h, --help  show this help message and exit',
+     ])
+ 
+@@ -70,7 +71,7 @@ def test_help_list(testdir, args):
+         "",
+         "List saved runs.",
+         "",
+-        "optional arguments:",
++        "%s:" % OPTIONS,
+         "  -h, --help  show this help message and exit",
+     ])
+     assert result.ret == 0
+@@ -92,7 +93,7 @@ def test_help_compare(testdir, args):
+         "  glob_or_file          Glob or exact path for json files. If not specified",
+         "                        all runs are loaded.",
+         "",
+-        "optional arguments:",
++        "%s:" % OPTIONS,
+         "  -h, --help            show this help message and exit",
+         "  --sort COL            Column to sort on. Can be one of: 'min', 'max',",
+         "                        'mean', 'stddev', 'name', 'fullname'. Default: 'min'",



More information about the arch-commits mailing list