about summary refs log tree commit diff
path: root/pkgs/tools/audio
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2023-10-26 23:25:39 +0300
committerDoron Behar <doron.behar@gmail.com>2023-10-27 00:23:08 +0300
commitfa95aced90d018037bada93227f8b4ae8f79df3f (patch)
tree52a3a724b1e50be07154a218181b0a1801b7ee1e /pkgs/tools/audio
parent377a39f0a23899132e7fa61eab130547c631896f (diff)
downloadnixlib-fa95aced90d018037bada93227f8b4ae8f79df3f.tar
nixlib-fa95aced90d018037bada93227f8b4ae8f79df3f.tar.gz
nixlib-fa95aced90d018037bada93227f8b4ae8f79df3f.tar.bz2
nixlib-fa95aced90d018037bada93227f8b4ae8f79df3f.tar.lz
nixlib-fa95aced90d018037bada93227f8b4ae8f79df3f.tar.xz
nixlib-fa95aced90d018037bada93227f8b4ae8f79df3f.tar.zst
nixlib-fa95aced90d018037bada93227f8b4ae8f79df3f.zip
beets{,-unstable}: use pytestCheckHook; small reformattings
Diffstat (limited to 'pkgs/tools/audio')
-rw-r--r--pkgs/tools/audio/beets/common.nix59
1 files changed, 16 insertions, 43 deletions
diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix
index 440606bdd836..3fdf8381dc59 100644
--- a/pkgs/tools/audio/beets/common.nix
+++ b/pkgs/tools/audio/beets/common.nix
@@ -93,24 +93,6 @@ python3Packages.buildPythonApplication {
     cp extra/_beet $out/share/zsh/site-functions/
   '';
 
-  doInstallCheck = true;
-
-  installCheckPhase = ''
-    runHook preInstallCheck
-
-    tmphome="$(mktemp -d)"
-
-    EDITOR="${writeScript "beetconfig.sh" ''
-      #!${runtimeShell}
-      cat > "$1" <<CFG
-      plugins: ${lib.concatStringsSep " " (attrNames enabledPlugins)}
-      CFG
-    ''}" HOME="$tmphome" "$out/bin/beet" config -e
-    EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e
-
-    runHook postInstallCheck
-  '';
-
   makeWrapperArgs = [
     "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\""
     "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\""
@@ -118,7 +100,7 @@ python3Packages.buildPythonApplication {
   ];
 
   nativeCheckInputs = with python3Packages; [
-    pytest
+    pytestCheckHook
     mock
     rarfile
     responses
@@ -126,9 +108,8 @@ python3Packages.buildPythonApplication {
 
   disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins));
 
-  checkPhase = ''
-    runHook preCheck
-
+  # Perform extra "sanity checks", before running pytest tests.
+  preCheck = ''
     # Check for undefined plugins
     find beetsplug -mindepth 1 \
       \! -path 'beetsplug/__init__.py' -a \
@@ -140,19 +121,13 @@ python3Packages.buildPythonApplication {
     export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc"
     export HOME="$(mktemp -d)"
 
-    args=" -m pytest -r fEs"
-    eval "disabledTestPaths=($disabledTestPaths)"
-    for path in ''${disabledTestPaths[@]}; do
-      if [ -e "$path" ]; then
-        args+=" --ignore $path"
-      else
-        echo "Skipping non-existent test path '$path'"
-      fi
-    done
-
-    python $args
-
-    runHook postCheck
+    env EDITOR="${writeScript "beetconfig.sh" ''
+      #!${runtimeShell}
+      cat > "$1" <<CFG
+      plugins: ${lib.concatStringsSep " " (attrNames enabledPlugins)}
+      CFG
+    ''}" "$out/bin/beet" config -e
+    env EDITOR=true "$out/bin/beet" config -e
   '';
 
 
@@ -160,19 +135,17 @@ python3Packages.buildPythonApplication {
 
   passthru.tests.gstreamer = runCommand "beets-gstreamer-test" {
     meta.timeout = 60;
-  }
-  ''
-  set -euo pipefail
-  export HOME=$(mktemp -d)
-  mkdir $out
+  } ''
+    set -euo pipefail
+    export HOME=$(mktemp -d)
+    mkdir $out
 
-  cat << EOF > $out/config.yaml
+    cat << EOF > $out/config.yaml
 replaygain:
   backend: gstreamer
 EOF
 
-  echo $out/config.yaml
-  ${beets}/bin/beet -c $out/config.yaml > /dev/null
+    ${beets}/bin/beet -c $out/config.yaml > /dev/null
   '';
 
   meta = with lib; {