From 26faf8daa9527216e106f8d9d5f59dc085cd7d9c Mon Sep 17 00:00:00 2001 From: wisp3rwind <17089248+wisp3rwind@users.noreply.github.com> Date: Sat, 24 Jun 2023 11:06:50 +0200 Subject: [PATCH] test_ui: Fix spurious warnings in completion test probably an issue going back to the Python 2 -> 3 switch: `map` gives an iterator nowadays so after the test case started iterating BASH_COMPLETION_PATHS, print_completion() couldn't find the (previously found) bash_completion anymore, and would log a spurious warning about that. Also, some cleaup of path type handling --- beets/ui/commands.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 68cc7b635..50a544d12 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1828,20 +1828,20 @@ default_commands.append(config_cmd) def print_completion(*args): for line in completion_script(default_commands + plugins.commands()): print_(line, end='') - if not any(map(os.path.isfile, BASH_COMPLETION_PATHS)): + if not any(os.path.isfile(syspath(p)) for p in BASH_COMPLETION_PATHS): log.warning('Warning: Unable to find the bash-completion package. ' 'Command line completion might not work.') -BASH_COMPLETION_PATHS = map(syspath, [ - '/etc/bash_completion', - '/usr/share/bash-completion/bash_completion', - '/usr/local/share/bash-completion/bash_completion', +BASH_COMPLETION_PATHS = [ + b'/etc/bash_completion', + b'/usr/share/bash-completion/bash_completion', + b'/usr/local/share/bash-completion/bash_completion', # SmartOS - '/opt/local/share/bash-completion/bash_completion', + b'/opt/local/share/bash-completion/bash_completion', # Homebrew (before bash-completion2) - '/usr/local/etc/bash_completion', -]) + b'/usr/local/etc/bash_completion', +] def completion_script(commands):