Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add package name variant project script #1199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies = [
]

[project.scripts]
python-semantic-release = "semantic_release.__main__:main"
semantic-release = "semantic_release.__main__:main"
psr = "semantic_release.__main__:main"

Expand Down
27 changes: 26 additions & 1 deletion tests/e2e/test_main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import json
import subprocess
from pathlib import Path
from textwrap import dedent
from typing import TYPE_CHECKING
Expand All @@ -12,7 +13,7 @@
from semantic_release import __version__
from semantic_release.cli.commands.main import main

from tests.const import MAIN_PROG_NAME, VERSION_SUBCMD
from tests.const import MAIN_PROG_NAME, SUCCESS_EXIT_CODE, VERSION_SUBCMD
from tests.fixtures.repos import repo_w_no_tags_conventional_commits
from tests.util import assert_exit_code, assert_successful_exit_code

Expand All @@ -25,6 +26,30 @@
from tests.fixtures.git_repo import BuiltRepoResult


@pytest.mark.parametrize(
"project_script_name",
[
"python-semantic-release",
"semantic-release",
"psr",
],
)
def test_entrypoint_scripts(project_script_name: str):
# Setup
command = str.join(" ", [project_script_name, "--version"])
expected_output = f"semantic-release, version {__version__}\n"

# Act
proc = subprocess.run( # noqa: S602, PLW1510
command, shell=True, text=True, capture_output=True
)

# Evaluate
assert SUCCESS_EXIT_CODE == proc.returncode # noqa: SIM300
assert expected_output == proc.stdout
assert not proc.stderr


def test_main_prints_version_and_exits(cli_runner: CliRunner):
cli_cmd = [MAIN_PROG_NAME, "--version"]

Expand Down
Loading