beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.78k stars 1.82k forks source link

test failure - FAILED test/test_ui.py::CompletionTest::test_completion #5243

Closed Kangie closed 3 months ago

Kangie commented 4 months ago

Problem

Attempting to build and test beets current master (c75f07a0da6c622d3cd0f5aad0a08edaea360dad) for Gentoo Linux and I can't manage to get bash completions to test.

FAILED test/test_ui.py::CompletionTest::test_completion - AssertionError: True is not false : test/test_completion.sh did not execute properly. Output:

This occurs both within the Portage ebuild environment, or if I check out the sources and manually run the build steps.

if I manually run the script with bash it fails, but /bin/sh seems fine?

kangie@monolith /tmp/beets/test $ bash rsrc/test_completion.sh
+ bash rsrc/test_completion.sh
rsrc/test_completion.sh: line 9: _beet: command not found
test_command_aliases failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_commands failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_fields_command failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_global_dir_opts failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_global_file_opts failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_global_opts failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_help_command failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_import_files failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_import_options failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_list_options failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_list_query failed
rsrc/test_completion.sh: line 9: _beet: command not found
test_plugin_command failed
Time: 0h:00m:23s                                                                                                                                                                                                                                
kangie@monolith /tmp/beets/test (master*) $ bash   
kangie@monolith /tmp/beets/test $ sh rsrc/test_completion.sh
completion tests passed

As an aside, I also can't seem to find this test being executed in any CI Jobs via a quick search of the latest logs, is that the case?


====================================================================================================== FAILURES =======================================================================================================
___________________________________________________________________________________________ CompletionTest.test_completion ____________________________________________________________________________________________

self = <test.test_ui.CompletionTest testMethod=test_completion>

    def test_completion(self):
        # Load plugin commands
        config["pluginpath"] = [_common.PLUGINPATH]
        config["plugins"] = ["test"]

        # Do not load any other bash completion scripts on the system.
        env = dict(os.environ)
        env["BASH_COMPLETION_DIR"] = os.devnull
        env["BASH_COMPLETION_COMPAT_DIR"] = os.devnull

        # 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()
        if not has_program(cmd[0]):
            self.skipTest("bash not available")
        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)):
                bash_completion = path
                break
        else:
            self.skipTest("bash-completion script not found")
        try:
            with open(util.syspath(bash_completion), "rb") as f:
                tester.stdin.writelines(f)
        except OSError:
            self.skipTest("could not read bash-completion script")

        # Load completion script.
        self.io.install()
        self.run_command("completion", lib=None)
        completion_script = self.io.getoutput().encode("utf-8")
        self.io.restore()
        tester.stdin.writelines(completion_script.splitlines(True))

        # 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()
>       self.assertFalse(
            tester.returncode != 0 or out != b"completion tests passed\n",
            f"test/test_completion.sh did not execute properly. "
            f'Output:{out.decode("utf-8")}',
        )
E       AssertionError: True is not false : test/test_completion.sh did not execute properly. Output:

bash_completion = b'/usr/share/bash-completion/bash_completion'
cmd        = ['/bin/bash', '--norc']
completion_script = (b'# This file is part of beets.\n# Copyright (c) 2014, Thomas Scholtes.\n#\n#'
 b' Permission is hereby granted, free of charge, to any person obtaining\n#'
 b' a copy of this software and associated documentation files (the\n# "Soft'
 b'ware"), to deal in the Software without restriction, including\n# without'
 b' limitation the rights to use, copy, modify, merge, publish,\n# distribut'
 b'e, sublicense, and/or sell copies of the Software, and to\n# permit perso'
 b'ns to whom the Software is furnished to do so, subject to\n# the followin'
 b'g conditions:\n#\n# The above copyright notice and this permission notice '
 b'shall be\n# included in all copies or substantial portions of the Softwar'
 b'e.\n\n\n\n# Completion for the `beet` command\n# ========================'
 b'=========\n#\n# Load this script to complete beets subcommands, options, a'
 b'nd\n# queries.\n#\n# If a beets command is found on the command line it com'
 b"pletes filenames and\n# the subcommand's options. Otherwise it will compl"
 b'ete global options and\n# subcommands. If the previous option on the comm'
 b'and line expects an argument,\n# it also completes filenames or directori'
 b"es.  Options are only\n# completed if '-' has already been typed on the c"
 b'ommand line.\n#\n# Note that completion of plugin commands only works for '
 b'those plugins\n# that were enabled when running `beet completion`. It doe'
 b's not check\n# plugins dynamically\n#\n# Currently, only Bash 3.2 and newer'
 b' is supported and the\n# `bash-completion` package is required.\n#\n# TODO\n'
 b'# ----\n#\n# * There are some issues with arguments that are quoted on the'
 b' command line.\n#\n# * Complete arguments for the `--format` option by exp'
 b'anding field variables.\n#\n#     beet ls -f "$tit[TAB]\n#     beet ls -f "'
 b'$title\n#\n# * Support long options with `=`, e.g. `--config=file`. Debian'
 b"'s bash\n#   completion package can handle this.\n#\n\n\n# Determines the"
 b' beets subcommand and dispatches the completion\n# accordingly.\n_beet_dis'
 b'patch() {\n  local cur prev cmd=\n\n  COMPREPLY=()\n  _get_comp_words_by_ref'
 b' -n : cur prev\n\n  # Look for the beets subcommand\n  local arg\n  for (( i'
 b'=1; i < COMP_CWORD; i++ )); do\n      arg="${COMP_WORDS[i]}"\n      if _li'
 b'st_include_item "${opts___global}" $arg; then\n        ((i++))\n      elif'
 b' [[ "$arg" != -* ]]; then\n        cmd="$arg"\n        break\n      fi\n  do'
 b'ne\n\n  # Replace command shortcuts\n  if [[ -n $cmd ]] && _list_include_it'
 b'em "$aliases" "$cmd"; then\n    eval "cmd=\\$alias__${cmd//-/_}"\n  fi\n'
 b'\n  case $cmd in\n    help)\n      COMPREPLY+=( $(compgen -W "$commands" --'
 b' $cur) )\n      ;;\n    list|remove|move|update|write|stats)\n      _beet_c'
 b'omplete_query\n      ;;\n    "")\n      _beet_complete_global\n      ;;\n'
 b'    *)\n      _beet_complete\n      ;;\n  esac\n}\n\n\n# Adds option and fi'
 b'le completion to COMPREPLY for the subcommand $cmd\n_beet_complete() {\n  '
 b'if [[ $cur == -* ]]; then\n    local opts flags completions\n    eval "opt'
 b's=\\$opts__${cmd//-/_}"\n    eval "flags=\\$flags__${cmd//-/_}"\n    complet'
 b'ions="${flags___common} ${opts} ${flags}"\n    COMPREPLY+=( $(compgen -W '
 b'"$completions"  -- $cur) )\n  else\n    _filedir\n  fi\n}\n\n\n# Add global'
 b' options and subcommands to the completion\n_beet_complete_global() {\n  c'
 b'ase $prev in\n    -h|--help)\n      # Complete commands\n      COMPREPLY+=('
 b' $(compgen -W "$commands" -- $cur) )\n      return\n      ;;\n    -l|--libr'
 b'ary|-c|--config)\n      # Filename completion\n      _filedir\n      return'
 b'\n      ;;\n    -d|--directory)\n      # Directory completion\n      _filedi'
 b'r -d\n      return\n      ;;\n  esac\n\n  if [[ $cur == -* ]]; then\n    l'
 b'ocal completions="$opts___global $flags___global"\n    COMPREPLY+=( $(com'
 b'pgen -W "$completions" -- $cur) )\n  elif [[ -n $cur ]] && _list_include_'
 b'item "$aliases" "$cur"; then\n    local cmd\n    eval "cmd=\\$alias__${cur/'
 b'/-/_}"\n    COMPREPLY+=( "$cmd" )\n  else\n    COMPREPLY+=( $(compgen -W "$'
 b'commands" -- $cur) )\n  fi\n}\n\n_beet_complete_query() {\n  local opts\n '
 b' eval "opts=\\$opts__${cmd//-/_}"\n\n  if [[ $cur == -* ]] || _list_include'
 b'_item "$opts" "$prev"; then\n    _beet_complete\n  elif [[ $cur != \\\'* && '
 b'$cur != \\"* &&\n          $cur != *:* ]]; then\n    # Do not complete quot'
 b'ed queries or those who already have a field\n    # set.\n    compopt -o n'
 b'ospace\n    COMPREPLY+=( $(compgen -S : -W "$fields" -- $cur) )\n    retur'
 b'n 0\n  fi\n}\n\n# Returns true if the space separated list $1 includes $'
 b'2\n_list_include_item() {\n  [[ " $1 " == *[[:space:]]$2[[:space:]]* ]]\n}\n'
 b'\n# This is where beets dynamically adds the _beet function. This\n# funct'
 b'ion sets the variables $flags, $opts, $commands, and $aliases.\ncomplete '
 b"-o filenames -F _beet beet\n_beet() {\n  local commands='fields help impor"
 b't list update remove stats version modify move write config completion test '
 b"plugin'\n\n  local aliases='imp im ls upd up rm mod mv'\n  local alias__imp"
 b'=import\n  local alias__im=import\n  local alias__ls=list\n  local alias__u'
 b'pd=update\n  local alias__up=update\n  local alias__rm=remove\n  local alia'
 b"s__mod=modify\n  local alias__mv=move\n\n  fields='artpath artist mb_albuma"
 b'rtistids trackdisambig original_year samplerate rg_album_peak lyricist barco'
 b'de discogs_artistid mb_artistids remixer arranger month channels day style m'
 b'b_releasetrackid title releasegroupdisambig acoustid_id discogs_albumid lyri'
 b'cs label r128_album_gain catalognum genre path mb_albumartistid encoder_info'
 b' work artists_ids mb_artistid mb_workid comments artists_sort albumtypes alb'
 b'umartist_sort artist_credit albumartists_credit original_day bitdepth mtime '
 b'acoustid_fingerprint album script disctitle albumtype mb_trackid albumstatus'
 b' artists bpm asin release_group_title country disc encoder disctotal albumdi'
 b'sambig isrc rg_track_peak grouping mb_albumid composer_sort comp media encod'
 b'er_settings track initial_key artist_sort rg_track_gain year albumartists wo'
 b'rk_disambig tracktotal mb_releasegroupid rg_album_gain length albumartist al'
 b'bum_id id artists_credit composer bitrate albumartists_sort added albumartis'
 b't_credit bitrate_mode discogs_labelid original_month format language r128_tr'
 b"ack_gain'\n  local flags__import='-c --copy -C --nocopy -m --move -w --wr"
 b'ite -W --nowrite -a --autotag -A --noautotag -p --resume -P --noresume -q --'
 b'quiet -s --singletons -t --timid -L --library -i --incremental -I --noincrem'
 b'ental -R --incremental-skip-later -r --noincremental-skip-later --from-scrat'
 b"ch --flat -g --group-albums --pretend'\n  local opts__import='--quiet-fal"
 b"lback -l --log -S --search-id --from-logfile --set'\n  local flags__list="
 b"'-a --album'\n  local opts__list='-p --path -f --format'\n  local flags__u"
 b"pdate='-a --album -m --move -M --nomove -p --pretend'\n  local opts__upda"
 b"te='-f --format -F --field -e --exclude-field'\n  local flags__remove='-d"
 b" --delete -f --force -a --album'\n  local flags__stats='-e --exact'\n  loc"
 b"al flags__modify='-m --move -M --nomove -w --write -W --nowrite -a --album -"
 b"y --yes -I --noinherit'\n  local opts__modify='-f --format'\n  local flags"
 b"__move='-c --copy -p --pretend -t --timid -e --export -a --album'\n  loca"
 b"l opts__move='-d --dest'\n  local flags__write='-p --pretend -f --force'\n"
 b"  local flags__config='-p --paths -e --edit -d --defaults -c --clear'\n  "
 b"local opts__test='-o --option'\n  local flags___global='-v --verbose'\n  l"
 b"ocal opts___global='-l --library -c --config -d --directory -h --help'\n "
 b" local flags___common='-h --help'\n  _beet_dispatch\n}\n")
env        = {'ANT_HOME': '/usr/share/ant',
 'AUTOJUMP_ERROR_PATH': '/home/kangie/.local/share/autojump/errors.log',
 'AUTOJUMP_SOURCED': '1',
 'BASH_COMPLETION_COMPAT_DIR': '/dev/null',
 'BASH_COMPLETION_DIR': '/dev/null',
 'COLORFGBG': '15;0',
 'COLORTERM': 'truecolor',
 'CONFIG_PROTECT': '/usr/share/gnupg/qualified.txt /usr/share/config '
                   '/usr/lib64/libreoffice/program/sofficerc',
 'CONFIG_PROTECT_MASK': '/etc/sandbox.d /etc/fonts/fonts.conf '
                        '/etc/gentoo-release /etc/dconf '
                        '/etc/ca-certificates.conf /etc/revdep-rebuild',
 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus',
 'DESKTOP_SESSION': 'plasma',
 'DISPLAY': ':1',
 'DOTNET_ROOT': '/opt/dotnet-sdk-bin-8.0',
 'GCC_SPECS': '',
 'GSETTINGS_BACKEND': 'dconf',
 'GTK2_RC_FILES': '/etc/gtk-2.0/gtkrc:/home/kangie/.gtkrc-2.0:/home/kangie/.config/gtkrc-2.0',
 'GTK_RC_FILES': '/etc/gtk/gtkrc:/home/kangie/.gtkrc:/home/kangie/.config/gtkrc',
 'HOME': '/tmp/tmpg0zpspop',
 'INFOPATH': '/usr/share/gcc-data/x86_64-pc-linux-gnu/13/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.42/info:/usr/share/autoconf-2.72/info:/usr/share/autoconf-2.13/info:/usr/share/automake-1.16.5/info:/usr/share/info',
 'INVOCATION_ID': 'a1caaf81137a4016bb6da4c727aadd10',
 'JAVAC': '/home/kangie/.gentoo/java-config-2/current-user-vm/bin/javac',
 'JAVA_HOME': '/home/kangie/.gentoo/java-config-2/current-user-vm',
 'JDK_HOME': '/home/kangie/.gentoo/java-config-2/current-user-vm',
 'JOURNAL_STREAM': '8:12171',
 'KDE_APPLICATIONS_AS_SCOPE': '1',
 'KDE_FULL_SESSION': 'true',
 'KDE_SESSION_UID': '1000',
 'KDE_SESSION_VERSION': '6',
 'KONSOLE_DBUS_SERVICE': ':1.438',
 'KONSOLE_DBUS_SESSION': '/Sessions/1',
 'KONSOLE_DBUS_WINDOW': '/Windows/1',
 'KONSOLE_VERSION': '240202',
 'LANG': 'en_AU.utf-8',
 'LANGUAGE': '',
 'LESS': '-R -M --shift 5',
 'LESSOPEN': '|lesspipe %s',
 'LEX': 'flex',
 'LOGNAME': 'kangie',
 'LSCOLORS': 'Gxfxcxdxbxegedabagacad',
 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.cfg=00;32:*.conf=00;32:*.diff=00;32:*.doc=00;32:*.ini=00;32:*.log=00;32:*.patch=00;32:*.pdf=00;32:*.ps=00;32:*.tex=00;32:*.txt=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:',
 'MAIL': '/var/mail/kangie',
 'MANAGERPID': '1870',
 'MANPAGER': 'manpager',
 'MANPATH': '/home/kangie/.gentoo/java-config-2/current-user-vm/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/13/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.42/man:/etc/java-config-2/current-system-vm/man/:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man:/usr/lib/llvm/18/share/man:/usr/lib/llvm/17/share/man:/usr/lib/llvm/16/share/man:/etc/eselect/wine/share/man',
 'MOTD_SHOWN': 'pam',
 'MOZ_GMP_PATH': '/usr/lib64/nsbrowser/plugins/gmp-gmpopenh264/system-installed',
 'NPM_CONFIG_GLOBALCONFIG': '/etc/npm/npmrc',
 'OLDPWD': '/tmp',
 'PAGER': '/usr/bin/less',
 'PAM_KWALLET5_LOGIN': '/run/user/1000/kwallet5.socket',
 'PATH': '/home/kangie/.autojump/bin:/home/kangie/.autojump/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin:/etc/eselect/wine/bin:/data/development/scripts/sam-gentoo-scripts:/data/development/scripts/sam-gentoo-scripts/gcc:/data/development/scripts/sam-gentoo-scripts/git:/data/development/scripts/sam-gentoo-scripts/keywords:/data/development/scripts/sam-gentoo-scripts/maint:/data/development/scripts/sam-gentoo-scripts/niche:/data/development/scripts/sam-gentoo-scripts/qa:/data/development/scripts/sam-gentoo-scripts/sync:/home/kangie/.local/bin',
 'PROFILEHOME': '',
 'PWD': '/tmp/beets',
 'PYTEST_CURRENT_TEST': 'test/test_ui.py::CompletionTest::test_completion '
                        '(call)',
 'PYTEST_VERSION': '8.2.0',
 'QT_AUTO_SCREEN_SCALE_FACTOR': '0',
 'QT_WAYLAND_RECONNECT': '1',
 'ROOTPATH': '/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin',
 'SESSION_MANAGER': 'local/monolith:@/tmp/.ICE-unix/2046,unix/monolith:/tmp/.ICE-unix/2046',
 'SHELL': '/bin/zsh',
 'SHELL_SESSION_ID': '4ef6c79f8bb24b5995053fa948ca9400',
 'SHLVL': '1',
 'SSH_ASKPASS': '/usr/bin/ksshaskpass',
 'SSH_AUTH_SOCK': '/run/user/1000/gnupg/S.gpg-agent.ssh',
 'SYSTEMD_EXEC_PID': '2126',
 'TERM': 'xterm-256color',
 'USER': 'kangie',
 'VBOX_APP_HOME': '/usr/lib64/virtualbox',
 'VBOX_INSTALL_PATH': '/usr/lib64/virtualbox',
 'VBOX_SDK_PATH': '/usr/lib64/virtualbox/sdk',
 'WAYLAND_DISPLAY': 'wayland-0',
 'WINDOWID': '3',
 'XAUTHORITY': '/run/user/1000/xauth_kXdfaW',
 'XDG_ACTIVATION_TOKEN': 'kwin-134',
 'XDG_CONFIG_DIRS': '/home/kangie/.config/kdedefaults:/etc/xdg',
 'XDG_CURRENT_DESKTOP': 'KDE',
 'XDG_DATA_DIRS': '/usr/local/share:/usr/share:/etc/eselect/wine/share',
 'XDG_MENU_PREFIX': 'plasma-',
 'XDG_RUNTIME_DIR': '/run/user/1000',
 'XDG_SEAT': 'seat0',
 'XDG_SEAT_PATH': '/org/freedesktop/DisplayManager/Seat0',
 'XDG_SESSION_CLASS': 'user',
 'XDG_SESSION_DESKTOP': 'KDE',
 'XDG_SESSION_ID': '2',
 'XDG_SESSION_PATH': '/org/freedesktop/DisplayManager/Session1',
 'XDG_SESSION_TYPE': 'wayland',
 'XDG_VTNR': '1',
 'ZSH': '/home/kangie/.oh-my-zsh',
 'ZSH_COMMAND_TIME': '',
 '_': '/usr/bin/python3.12'}
err        = None
f          = <_io.BufferedReader name=b'/usr/share/bash-completion/bash_completion'>
out        = b''
path       = b'/usr/share/bash-completion/bash_completion'
self       = <test.test_ui.CompletionTest testMethod=test_completion>
test_script_file = <_io.BufferedReader name=b'/tmp/beets/test/rsrc/test_completion.sh'>
test_script_name = b'/tmp/beets/test/rsrc/test_completion.sh'
tester     = <Popen: returncode: 1 args: ['/bin/bash', '--norc']>

test/test_ui.py:1464: AssertionError
------------------------------------------------------------------------------------------------ Captured stderr call -------------------------------------------------------------------------------------------------

Setup

bal-e commented 3 months ago

I get the same error when I try to run tests locally. It does appear to succeed on the CI (e.g. https://github.com/beetbox/beets/actions/runs/9480562167/job/26121519535#step:8:104).

bal-e commented 3 months ago

Okay, I think I've narrowed this down. The completion script _beet relies on some functions that are apparently now deprecated in bash-completion, such as _get_comp_words_by_ref. The test_completion function will run bash with the --norc option, which apparently prevents the implementations of these deprecated functions from being loaded in. This might be distribution-specific behavior. On my system (Arch Linux, bash-completion-2.14.0-2), the implementations of these functions are provided in /etc/bash_completion.d/000_bash_completion_compat.bash. When I run bash (without --norc), _get_comp_words_by_ref is loaded in by default. It is not available to bash --norc.

bal-e commented 3 months ago

I have identified the issue. The test_completion function explicitly disables the use of compatibility functions for the _beet completion script (https://github.com/beetbox/beets/blob/d7bf28deed1c47ceb418960a2f5009eeb0ecd750/test/test_ui.py#L1428), but for some reason these get loaded in CI anyways. The problem is not with the build environment, but with the completion script itself. I personally use fish, not bash, so I don't have any experience with this; but if no one else picks it up, I'll have a shot at it.