Skip to content

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

Merged
AyanSinhaMahapatra merged 1 commit into
aboutcode-org:developfrom
GuillemSeCa:fix/click-error-message-format
May 19, 2026
Merged

Make 'no such option' assertion tolerant of newer click error format#5009
AyanSinhaMahapatra merged 1 commit into
aboutcode-org:developfrom
GuillemSeCa:fix/click-error-message-format

Conversation

@GuillemSeCa
Copy link
Copy Markdown
Contributor

Fixes the *_latest_from_pip CI matrix (ubuntu22/24, macos14, win2019/2022) which currently fails on develop because click 8.2 changed the unknown-option error message format:

  • click < 8.2: Error: No such option: --foo
  • click >= 8.2: Error: No such option '--foo'. (Did you mean ...)

The test now asserts the stable substrings (no such option, --json--info) instead of the exact phrasing, so it works with both versions.

Verified locally: passes with click 8.3.1.

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>
@GuillemSeCa
Copy link
Copy Markdown
Contributor Author

I saw the CI was slow so I also made this optional PR to speed it up 1 order of magnitude: #5013

@GuillemSeCa GuillemSeCa marked this pull request as ready for review May 18, 2026 14:04
Copy link
Copy Markdown
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillemSeCa Thanks++ for this, merging!

@AyanSinhaMahapatra AyanSinhaMahapatra merged commit c0b8fcf into aboutcode-org:develop May 19, 2026
33 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants