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

+16 -43
+16 -43
pkgs/tools/audio/beets/common.nix
··· 93 93 cp extra/_beet $out/share/zsh/site-functions/ 94 94 ''; 95 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 96 makeWrapperArgs = [ 115 97 "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" 116 98 "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" ··· 118 100 ]; 119 101 120 102 nativeCheckInputs = with python3Packages; [ 121 - pytest 103 + pytestCheckHook 122 104 mock 123 105 rarfile 124 106 responses ··· 126 108 127 109 disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins)); 128 110 129 - checkPhase = '' 130 - runHook preCheck 131 - 111 + # Perform extra "sanity checks", before running pytest tests. 112 + preCheck = '' 132 113 # Check for undefined plugins 133 114 find beetsplug -mindepth 1 \ 134 115 \! -path 'beetsplug/__init__.py' -a \ ··· 140 121 export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc" 141 122 export HOME="$(mktemp -d)" 142 123 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 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 156 131 ''; 157 132 158 133 ··· 160 135 161 136 passthru.tests.gstreamer = runCommand "beets-gstreamer-test" { 162 137 meta.timeout = 60; 163 - } 164 - '' 165 - set -euo pipefail 166 - export HOME=$(mktemp -d) 167 - mkdir $out 138 + } '' 139 + set -euo pipefail 140 + export HOME=$(mktemp -d) 141 + mkdir $out 168 142 169 - cat << EOF > $out/config.yaml 143 + cat << EOF > $out/config.yaml 170 144 replaygain: 171 145 backend: gstreamer 172 146 EOF 173 147 174 - echo $out/config.yaml 175 - ${beets}/bin/beet -c $out/config.yaml > /dev/null 148 + ${beets}/bin/beet -c $out/config.yaml > /dev/null 176 149 ''; 177 150 178 151 meta = with lib; {