diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-07-14 11:00:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 11:00:22 +0200 |
commit | 2336d56ab269397960a4a264091dbfe4adafca24 (patch) | |
tree | 00dccd50bcc2db7b3221c4189d63abba8497873d /tests/testutils | |
parent | 29d93fc57ef505345484b7cda2eaf4161dd05128 (diff) | |
download | pylint-git-2336d56ab269397960a4a264091dbfe4adafca24.tar.gz |
[primer] Fix a silent fail when no command were given (#7185)
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
Diffstat (limited to 'tests/testutils')
-rw-r--r-- | tests/testutils/_primer/test_primer.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/testutils/_primer/test_primer.py b/tests/testutils/_primer/test_primer.py index 3093fa98e..28416de69 100644 --- a/tests/testutils/_primer/test_primer.py +++ b/tests/testutils/_primer/test_primer.py @@ -10,6 +10,7 @@ from pathlib import Path from unittest.mock import patch import pytest +from _pytest.capture import CaptureFixture from pylint.constants import IS_PYPY from pylint.testutils._primer.primer import Primer @@ -25,6 +26,16 @@ PRIMER_CURRENT_INTERPRETER = (3, 10) DEFAULT_ARGS = ["python tests/primer/__main__.py", "compare", "--commit=v2.14.2"] +@pytest.mark.parametrize("args", [[], ["wrong_command"]]) +def test_primer_launch_bad_args(args: list[str], capsys: CaptureFixture) -> None: + with pytest.raises(SystemExit): + with patch("sys.argv", ["python tests/primer/__main__.py"] + args): + Primer(PRIMER_DIRECTORY, PACKAGES_TO_PRIME_PATH).run() + out, err = capsys.readouterr() + assert not out + assert "usage: Pylint Primer" in err + + @pytest.mark.skipif( sys.platform in {"win32", "darwin"}, reason=( |