public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/scancode-toolkit] rawhide: Fix test failure with click 8.4
@ 2026-07-24 20:02 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-07-24 20:02 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/scancode-toolkit
            Branch : rawhide
            Commit : 8b9c6044e59788ccde62c74590e4f0499092d052
            Author : Benjamin A. Beasley <code@musicinmybrain.net>
            Date   : 2026-07-24T15:01:06-05:00
            Stats  : +44/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/scancode-toolkit/c/8b9c6044e59788ccde62c74590e4f0499092d052?branch=rawhide

            Log:
            Fix test failure with click 8.4

Make 'no such option' assertion tolerant of newer click error format

Closes: https://src.fedoraproject.org/rpms/scancode-toolkit/pull-request/8

---
diff --git a/a1c6435375866ae2fead2df2c967f2ba150f18e9.patch b/a1c6435375866ae2fead2df2c967f2ba150f18e9.patch
new file mode 100644
index 0000000..82a7906
--- /dev/null
+++ b/a1c6435375866ae2fead2df2c967f2ba150f18e9.patch
@@ -0,0 +1,41 @@
+From a1c6435375866ae2fead2df2c967f2ba150f18e9 Mon Sep 17 00:00:00 2001
+From: Guillem Serra Cazorla <guillem@meta.com>
+Date: Mon, 18 May 2026 14:19:39 +0100
+Subject: [PATCH] Make 'no such option' assertion tolerant of newer click error
+ format
+
+click >= 8.2 changed the unknown-option error message from
+  'Error: No such option: --foo'
+to
+  'Error: No such option '--foo'. (Did you mean ...)'
+
+This broke tests/scancode/test_cli.py::test_scan_errors_out_with_unknown_option
+on the *_latest_from_pip CI matrix (ubuntu22/24, macos14, win2019/2022).
+
+Relax the assertion to check for the stable substrings ('no such option'
+and the offending option name) instead of the exact phrasing, so the
+test works with both click < 8.2 and click >= 8.2.
+
+Signed-off-by: Guillem Serra Cazorla <guillem@meta.com>
+---
+ tests/scancode/test_cli.py | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/tests/scancode/test_cli.py b/tests/scancode/test_cli.py
+index 858baf68ca..9d038f71e6 100644
+--- a/tests/scancode/test_cli.py
++++ b/tests/scancode/test_cli.py
+@@ -730,7 +730,12 @@ def test_scan_errors_out_with_unknown_option():
+     test_file = test_env.get_test_loc('license_text/test.txt')
+     args = ['--json--info', test_file]
+     result = run_scan_click(args, expected_rc=2)
+-    assert 'Error: No such option: --json--info'.lower() in result.output.lower()
++    # Accept both the old and new click error message formats:
++    #   click < 8.2:  "Error: No such option: --json--info"
++    #   click >= 8.2: "Error: No such option '--json--info'. (Did you mean ...)"
++    output = result.output.lower()
++    assert 'no such option' in output
++    assert '--json--info' in output
+ 
+ 
+ def test_scan_to_json_without_FILE_does_not_write_to_next_option():

diff --git a/scancode-toolkit.spec b/scancode-toolkit.spec
index 156f393..740f4b4 100644
--- a/scancode-toolkit.spec
+++ b/scancode-toolkit.spec
@@ -21,6 +21,9 @@ Patch:          0001-tests-fix-pytest-traceback.patch
 # See note in https://github.com/aboutcode-org/scancode-toolkit/issues/4541
 # about why pkginfo2 was removed.
 Patch:          0002-Replace-pkginfo2-with-pkginfo.patch
+# Make 'no such option' assertion tolerant of newer click error format
+# https://github.com/aboutcode-org/scancode-toolkit/commit/a1c6435375866ae2fead2df2c967f2ba150f18e9
+Patch:          https://github.com/aboutcode-org/scancode-toolkit/commit/a1c6435375866ae2fead2df2c967f2ba150f18e9.patch
 
 # scancode has dependencies that are not compatible with ix86
 ExcludeArch:    %{ix86}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-24 20:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-24 20:02 [rpms/scancode-toolkit] rawhide: Fix test failure with click 8.4 Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox