https://github.com/python/cpython/commit/458367e60c14fd1b443af4ed7a3fd5135b6d0c35
commit: 458367e60c14fd1b443af4ed7a3fd5135b6d0c35
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-07-22T05:53:27Z
summary:
gh-154419: Find the fish shell in test_venv (GH-154420)
shutil.which('fish') can find the unrelated "Go Fish" game, which is
shipped on several BSD systems. Search PATH for an executable which
behaves like the fish shell instead.
Co-authored-by: Claude Opus 4.8 <[email protected]>
files:
M Lib/test/test_venv.py
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index 58ae85fb268042..e98e52c2ea2045 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -783,8 +783,16 @@ def test_fish_activate_shadowed_builtins(self):
shadows one of those builtins (a common pattern for `.`-style directory
navigators) must not hijack the prompt or break status restoration.
"""
- fish = shutil.which('fish')
- if fish is None:
+ # Some systems have an unrelated "fish" game (see fish(6)), which
+ # can precede the fish shell in PATH.
+ for dirname in None, *os.get_exec_path():
+ fish = shutil.which('fish', path=dirname)
+ if fish is not None and subprocess.run(
+ [fish, '-c', 'echo $FISH_VERSION'],
+ stdin=subprocess.DEVNULL,
+ capture_output=True).stdout.strip():
+ break
+ else:
self.skipTest('fish required for this test')
rmtree(self.env_dir)
builder = venv.EnvBuilder(clear=True)
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]