Skip to content

correctly handle uname-cmd that doesn't point to an executable file #2026

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
merged 16 commits into from
May 28, 2025
Merged
Changes from 1 commit
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
Next Next commit
add tests for is_cygwin_git
  • Loading branch information
gcmarx committed May 21, 2025
commit ec0087227ed37cf1df441e4f0f73daa25895c4b5
19 changes: 19 additions & 0 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
LockFile,
cygpath,
decygpath,
is_cygwin_git,
get_user_id,
remove_password_if_present,
rmtree,
Expand Down Expand Up @@ -349,6 +350,24 @@ def test_decygpath(self, wpath, cpath):
assert wcpath == wpath.replace("/", "\\"), cpath


class TestIsCygwinGit:
"""Tests for :func:`is_cygwin_git`"""

def test_on_path_executable(self):
match sys.platform:
case "cygwin":
assert is_cygwin_git("git")
case _:
assert not is_cygwin_git("git")

def test_none_executable(self):
assert not is_cygwin_git(None)

def test_with_missing_uname(self):
"""Test for handling when `uname` isn't in the same directory as `git`"""
assert not is_cygwin_git("/bogus_path/git")


class _Member:
"""A member of an IterableList."""

Expand Down