From 41156ef3fa222481ccd66beb98edeebe5b0b79fd Mon Sep 17 00:00:00 2001 From: J0J0 Todos Date: Fri, 17 Jan 2025 17:51:26 +0100 Subject: [PATCH] Fix test_completion by setting WHATEVER --- beets/ui/commands.py | 4 ++++ beets/ui/completion_base.sh | 1 + test/test_ui.py | 8 +++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 99aa04f0ac..dc77dc1a15 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -2433,6 +2433,9 @@ def print_completion(*args): b"/opt/local/share/bash-completion/bash_completion", # Homebrew (before bash-completion2) b"/usr/local/etc/bash_completion", + b"/opt/homebrew/etc/profile.d/", + b"/opt/homebrew/etc/profile.d/bash_completion", + b"/opt/homebrew/etc/profile.d/bash_completion.sh", ] @@ -2443,6 +2446,7 @@ def completion_script(commands): completion data for. """ base_script = os.path.join(os.path.dirname(__file__), "completion_base.sh") + print(base_script) with open(base_script) as base_script: yield base_script.read() diff --git a/beets/ui/completion_base.sh b/beets/ui/completion_base.sh index e83f9d2c54..1696b9193d 100644 --- a/beets/ui/completion_base.sh +++ b/beets/ui/completion_base.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # This file is part of beets. # Copyright (c) 2014, Thomas Scholtes. # diff --git a/test/test_ui.py b/test/test_ui.py index 0415700679..e5c097d358 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -1412,7 +1412,6 @@ def test_completion(self): tester = subprocess.Popen( cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=env ) - # Load bash_completion library. for path in commands.BASH_COMPLETION_PATHS: if os.path.exists(syspath(path)): @@ -1426,18 +1425,25 @@ def test_completion(self): except OSError: self.skipTest("could not read bash-completion script") + print("right before Load completion script") # Load completion script. self.io.install() + print("right after io.install command") self.run_command("completion", lib=None) + print("right after run_command") completion_script = self.io.getoutput().encode("utf-8") self.io.restore() tester.stdin.writelines(completion_script.splitlines(True)) + print("right after Load completion script block") # Load test suite. test_script_name = os.path.join(_common.RSRC, b"test_completion.sh") with open(test_script_name, "rb") as test_script_file: tester.stdin.writelines(test_script_file) out, err = tester.communicate() + print("err from tester") + print(err) + print() assert tester.returncode == 0 assert out == b"completion tests passed\n", ( "test/test_completion.sh did not execute properly. "