fix(cli): fail with exit code 2 when no subcommand is given to `semantic-release` by codejedi365 · Pull Request #1260 · python-semantic-release/python-semantic-release

Expand Up @@ -44,7 +44,7 @@ )
# Evaluate assert SUCCESS_EXIT_CODE == proc.returncode # noqa: SIM300

Check failure on line 47 in tests/e2e/test_main.py

View workflow job for this annotation

GitHub Actions / validate / Python 3.14 on ubuntu-latest E2E tests

test_main.test_entrypoint_scripts[psr]

assert == failed. [pytest-clarity diff shown] #x1B[0m #x1B[0m#x1B[32mLHS#x1B[0m vs #x1B[31mRHS#x1B[0m shown below #x1B[0m #x1B[0m#x1B[32m+ 0#x1B[0m #x1B[0m#x1B[31m- 2#x1B[0m #x1B[0m

Check failure on line 47 in tests/e2e/test_main.py

View workflow job for this annotation

GitHub Actions / validate / Python 3.14 on ubuntu-latest E2E tests

test_main.test_entrypoint_scripts[python-semantic-release]

assert == failed. [pytest-clarity diff shown] #x1B[0m #x1B[0m#x1B[32mLHS#x1B[0m vs #x1B[31mRHS#x1B[0m shown below #x1B[0m #x1B[0m#x1B[32m+ 0#x1B[0m #x1B[0m#x1B[31m- 2#x1B[0m #x1B[0m

Check failure on line 47 in tests/e2e/test_main.py

View workflow job for this annotation

GitHub Actions / validate / Python 3.14 on ubuntu-latest E2E tests

test_entrypoint_scripts[psr] assert == failed. [pytest-clarity diff shown] LHS vs RHS shown below + 0 - 2

Check failure on line 47 in tests/e2e/test_main.py

View workflow job for this annotation

GitHub Actions / validate / Python 3.14 on ubuntu-latest E2E tests

test_entrypoint_scripts[python-semantic-release] assert == failed. [pytest-clarity diff shown] LHS vs RHS shown below + 0 - 2

assert expected_output == proc.stdout assert not proc.stderr
Expand All @@ -60,12 +60,12 @@ assert result.output == f"semantic-release, version {__version__}\n"

def test_main_no_args_passes_w_help_text(): def test_main_no_args_fails_w_help_text(): from semantic_release.cli.commands.main import main
cli_cmd = [MAIN_PROG_NAME] result = CliRunner().invoke(main, prog_name=cli_cmd[0]) assert_successful_exit_code(result, cli_cmd) assert_exit_code(2, result, cli_cmd) assert "Usage: " in result.output

Expand Down