Skip to content

Commit

Permalink
Fix test_completion by setting WHATEVER
Browse files Browse the repository at this point in the history
  • Loading branch information
JOJ0 committed Jan 17, 2025
1 parent 594f2b3 commit db2d82e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions beets/ui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]


Expand All @@ -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()

Expand Down
1 change: 1 addition & 0 deletions beets/ui/completion_base.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# This file is part of beets.
# Copyright (c) 2014, Thomas Scholtes.
#
Expand Down
6 changes: 6 additions & 0 deletions test/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1407,14 +1407,20 @@ def test_completion(self):
# Open a `bash` process to run the tests in. We'll pipe in bash
# commands via stdin.
cmd = os.environ.get("BEETS_TEST_SHELL", "/bin/bash --norc").split()
print("cmd is:")
print(cmd)
print()
if not has_program(cmd[0]):
self.skipTest("bash not available")
tester = subprocess.Popen(
cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=env
)
print(tester)

print(commands.BASH_COMPLETION_PATHS)
# Load bash_completion library.
for path in commands.BASH_COMPLETION_PATHS:
print(path)
if os.path.exists(syspath(path)):
bash_completion = path
break
Expand Down

0 comments on commit db2d82e

Please sign in to comment.