Skip to content

tests: Use command -v instead of third-party which program #1525

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 1 commit into from
Dec 31, 2022
Merged
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
tests: Use command -v instead of third-party which program
Use `command -v` to locate the git executable instead of `which`.
The former is guaranteed to always be available according to POSIX,
while which(1) is a redundant third-party tool that is slowly being
phased out from Linux distributions.  In particular, Gentoo no longer
installs it by default.
  • Loading branch information
mgorny committed Dec 31, 2022
commit a12f25d7d753d6edc246d88f43023344efba14b3
2 changes: 1 addition & 1 deletion test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def test_refresh(self):
self.assertRaises(GitCommandNotFound, refresh, "yada")

# test a good path refresh
which_cmd = "where" if is_win else "which"
which_cmd = "where" if is_win else "command -v"
path = os.popen("{0} git".format(which_cmd)).read().strip().split("\n")[0]
refresh(path)

Expand Down