Skip to content

Commit c0b8fcf

Browse files
Merge pull request #5009 from GuillemSeCa/fix/click-error-message-format
Make 'no such option' assertion tolerant of newer click error format
2 parents bd47fa8 + a1c6435 commit c0b8fcf

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/scancode/test_cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,12 @@ def test_scan_errors_out_with_unknown_option():
730730
test_file = test_env.get_test_loc('license_text/test.txt')
731731
args = ['--json--info', test_file]
732732
result = run_scan_click(args, expected_rc=2)
733-
assert 'Error: No such option: --json--info'.lower() in result.output.lower()
733+
# Accept both the old and new click error message formats:
734+
# click < 8.2: "Error: No such option: --json--info"
735+
# click >= 8.2: "Error: No such option '--json--info'. (Did you mean ...)"
736+
output = result.output.lower()
737+
assert 'no such option' in output
738+
assert '--json--info' in output
734739

735740

736741
def test_scan_to_json_without_FILE_does_not_write_to_next_option():

0 commit comments

Comments
 (0)