Skip to content

Commit

Permalink
[symilar] Fix the short form options that weren't being processed pro…
Browse files Browse the repository at this point in the history
…perly

Closes #9343
  • Loading branch information
Pierre-Sassoulas committed Jun 7, 2024
1 parent 78cbbb7 commit c45401f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pylint/checkers/similar.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def Run(argv: Sequence[str] | None = None) -> NoReturn:
if argv is None:
argv = sys.argv[1:]

s_opts = "hdi"
s_opts = "hd:i:"
l_opts = [
"help",
"duplicates=",
Expand Down
8 changes: 4 additions & 4 deletions tests/checkers/unittest_similar.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ def test_bad_short_form_option() -> None:
output = StringIO()
with redirect_stdout(output), pytest.raises(SystemExit) as ex:
similar.Run([f"-{v}=0", SIMILAR1, SIMILAR2])
assert ex.value.code == 2
assert "option -= not recognized" in output.getvalue()
assert ex.value.code == 0
assert "similar lines in" in output.getvalue()


def test_good_short_form_option() -> None:
Expand All @@ -515,5 +515,5 @@ def test_good_short_form_option() -> None:
output = StringIO()
with redirect_stdout(output), pytest.raises(SystemExit) as ex:
similar.Run([f"-{v} 0", SIMILAR1, SIMILAR2])
assert ex.value.code == 2
assert "option - not recognized" in output.getvalue()
assert ex.value.code == 0
assert "similar lines in" in output.getvalue()

0 comments on commit c45401f

Please sign in to comment.