Skip to content

Commit 1ac97bc

Browse files
authored
feat: add package name variant, python-semantic-release, project script (#1199)
Adds support for default implementation of `uvx` which matches script name with package name. Resolves: #1195 * test(cli): add entrypoint script validation
1 parent 2e86825 commit 1ac97bc

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ dependencies = [
3939
]
4040

4141
[project.scripts]
42+
python-semantic-release = "semantic_release.__main__:main"
4243
semantic-release = "semantic_release.__main__:main"
4344
psr = "semantic_release.__main__:main"
4445

tests/e2e/test_main.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import json
4+
import subprocess
45
from pathlib import Path
56
from textwrap import dedent
67
from typing import TYPE_CHECKING
@@ -12,7 +13,7 @@
1213
from semantic_release import __version__
1314
from semantic_release.cli.commands.main import main
1415

15-
from tests.const import MAIN_PROG_NAME, VERSION_SUBCMD
16+
from tests.const import MAIN_PROG_NAME, SUCCESS_EXIT_CODE, VERSION_SUBCMD
1617
from tests.fixtures.repos import repo_w_no_tags_conventional_commits
1718
from tests.util import assert_exit_code, assert_successful_exit_code
1819

@@ -25,6 +26,30 @@
2526
from tests.fixtures.git_repo import BuiltRepoResult
2627

2728

29+
@pytest.mark.parametrize(
30+
"project_script_name",
31+
[
32+
"python-semantic-release",
33+
"semantic-release",
34+
"psr",
35+
],
36+
)
37+
def test_entrypoint_scripts(project_script_name: str):
38+
# Setup
39+
command = str.join(" ", [project_script_name, "--version"])
40+
expected_output = f"semantic-release, version {__version__}\n"
41+
42+
# Act
43+
proc = subprocess.run( # noqa: S602, PLW1510
44+
command, shell=True, text=True, capture_output=True
45+
)
46+
47+
# Evaluate
48+
assert SUCCESS_EXIT_CODE == proc.returncode # noqa: SIM300
49+
assert expected_output == proc.stdout
50+
assert not proc.stderr
51+
52+
2853
def test_main_prints_version_and_exits(cli_runner: CliRunner):
2954
cli_cmd = [MAIN_PROG_NAME, "--version"]
3055

0 commit comments

Comments
 (0)