diff --git a/src/pkgmgr/cli/commands/release.py b/src/pkgmgr/cli/commands/release.py index 6b1d3c4..8f107c2 100644 --- a/src/pkgmgr/cli/commands/release.py +++ b/src/pkgmgr/cli/commands/release.py @@ -25,6 +25,7 @@ def _at_cwd_checkout(args, selected: list[Repository]) -> list[Repository]: selected unchanged after an explicit selection or outside git; else each repository pointed at the current directory's git toplevel, so a release from a nested clone never commits in the configured main checkout. + """ if has_explicit_selection(args): return selected @@ -42,6 +43,7 @@ def release_at_cwd(args, ctx: CLIContext, selected: list[Repository]) -> None: ctx: the CLI context. selected: the repositories dispatch picked; without an explicit selection each is released in the current directory's checkout. + """ handle_release(args, ctx, _at_cwd_checkout(args, selected)) diff --git a/src/pkgmgr/core/repository/selected.py b/src/pkgmgr/core/repository/selected.py index 20e5cbb..f76422c 100644 --- a/src/pkgmgr/core/repository/selected.py +++ b/src/pkgmgr/core/repository/selected.py @@ -144,6 +144,7 @@ def has_explicit_selection(args) -> bool: Returns: True when --all, an identifier, --category, --tag or --string picks the repositories instead of the current directory. + """ return bool( getattr(args, "all", False) diff --git a/tests/integration/test_release_publish_hook.py b/tests/integration/test_release_publish_hook.py index 9073e06..562001c 100644 --- a/tests/integration/test_release_publish_hook.py +++ b/tests/integration/test_release_publish_hook.py @@ -2,6 +2,7 @@ from __future__ import annotations import io import os +import shutil import subprocess import tempfile import unittest @@ -13,6 +14,8 @@ from unittest.mock import patch from pkgmgr.actions.release.git_ops import ensure_clean_and_synced from pkgmgr.cli.context import CLIContext +GIT = shutil.which("git") + class TestIntegrationReleasePublishHook(unittest.TestCase): def _ctx(self) -> SimpleNamespace: @@ -73,9 +76,10 @@ class TestIntegrationReleasePublishHook(unittest.TestCase): m_publish.assert_not_called() +@unittest.skipUnless(GIT, "git builds the clones under test") class TestReleaseCwdCheckout(unittest.TestCase): def _sh(self, cwd: str, *argv: str) -> None: - subprocess.run(["git", *argv], cwd=cwd, check=True, capture_output=True) + subprocess.run([GIT, *argv], cwd=cwd, check=True, capture_output=True) def setUp(self) -> None: self._tmp = tempfile.TemporaryDirectory()