beets{,-unstable}: use pytestCheckHook; small reformattings

+16 -43
+16 -43
pkgs/tools/audio/beets/common.nix
··· 93 cp extra/_beet $out/share/zsh/site-functions/ 94 ''; 95 96 - doInstallCheck = true; 97 - 98 - installCheckPhase = '' 99 - runHook preInstallCheck 100 - 101 - tmphome="$(mktemp -d)" 102 - 103 - EDITOR="${writeScript "beetconfig.sh" '' 104 - #!${runtimeShell} 105 - cat > "$1" <<CFG 106 - plugins: ${lib.concatStringsSep " " (attrNames enabledPlugins)} 107 - CFG 108 - ''}" HOME="$tmphome" "$out/bin/beet" config -e 109 - EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e 110 - 111 - runHook postInstallCheck 112 - ''; 113 - 114 makeWrapperArgs = [ 115 "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" 116 "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" ··· 118 ]; 119 120 nativeCheckInputs = with python3Packages; [ 121 - pytest 122 mock 123 rarfile 124 responses ··· 126 127 disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins)); 128 129 - checkPhase = '' 130 - runHook preCheck 131 - 132 # Check for undefined plugins 133 find beetsplug -mindepth 1 \ 134 \! -path 'beetsplug/__init__.py' -a \ ··· 140 export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc" 141 export HOME="$(mktemp -d)" 142 143 - args=" -m pytest -r fEs" 144 - eval "disabledTestPaths=($disabledTestPaths)" 145 - for path in ''${disabledTestPaths[@]}; do 146 - if [ -e "$path" ]; then 147 - args+=" --ignore $path" 148 - else 149 - echo "Skipping non-existent test path '$path'" 150 - fi 151 - done 152 - 153 - python $args 154 - 155 - runHook postCheck 156 ''; 157 158 ··· 160 161 passthru.tests.gstreamer = runCommand "beets-gstreamer-test" { 162 meta.timeout = 60; 163 - } 164 - '' 165 - set -euo pipefail 166 - export HOME=$(mktemp -d) 167 - mkdir $out 168 169 - cat << EOF > $out/config.yaml 170 replaygain: 171 backend: gstreamer 172 EOF 173 174 - echo $out/config.yaml 175 - ${beets}/bin/beet -c $out/config.yaml > /dev/null 176 ''; 177 178 meta = with lib; {
··· 93 cp extra/_beet $out/share/zsh/site-functions/ 94 ''; 95 96 makeWrapperArgs = [ 97 "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" 98 "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" ··· 100 ]; 101 102 nativeCheckInputs = with python3Packages; [ 103 + pytestCheckHook 104 mock 105 rarfile 106 responses ··· 108 109 disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins)); 110 111 + # Perform extra "sanity checks", before running pytest tests. 112 + preCheck = '' 113 # Check for undefined plugins 114 find beetsplug -mindepth 1 \ 115 \! -path 'beetsplug/__init__.py' -a \ ··· 121 export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc" 122 export HOME="$(mktemp -d)" 123 124 + env EDITOR="${writeScript "beetconfig.sh" '' 125 + #!${runtimeShell} 126 + cat > "$1" <<CFG 127 + plugins: ${lib.concatStringsSep " " (attrNames enabledPlugins)} 128 + CFG 129 + ''}" "$out/bin/beet" config -e 130 + env EDITOR=true "$out/bin/beet" config -e 131 ''; 132 133 ··· 135 136 passthru.tests.gstreamer = runCommand "beets-gstreamer-test" { 137 meta.timeout = 60; 138 + } '' 139 + set -euo pipefail 140 + export HOME=$(mktemp -d) 141 + mkdir $out 142 143 + cat << EOF > $out/config.yaml 144 replaygain: 145 backend: gstreamer 146 EOF 147 148 + ${beets}/bin/beet -c $out/config.yaml > /dev/null 149 ''; 150 151 meta = with lib; {