about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/audio/beets/common.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/audio/beets/common.nix')
-rw-r--r--nixpkgs/pkgs/tools/audio/beets/common.nix70
1 files changed, 20 insertions, 50 deletions
diff --git a/nixpkgs/pkgs/tools/audio/beets/common.nix b/nixpkgs/pkgs/tools/audio/beets/common.nix
index 440606bdd836..37faff29c728 100644
--- a/nixpkgs/pkgs/tools/audio/beets/common.nix
+++ b/nixpkgs/pkgs/tools/audio/beets/common.nix
@@ -26,6 +26,8 @@
 , extraPatches ? [ ]
 , pluginOverrides ? { }
 , disableAllPlugins ? false
+, disabledTests ? []
+, extraNativeBuildInputs ? []
 
   # tests
 , runCommand
@@ -52,12 +54,6 @@ python3Packages.buildPythonApplication {
 
   patches = extraPatches;
 
-  postPatch = ''
-    # https://github.com/beetbox/beets/pull/4868
-    substituteInPlace beets/util/artresizer.py \
-      --replace "Image.ANTIALIAS" "Image.Resampling.LANCZOS"
-  '';
-
   propagatedBuildInputs = with python3Packages; [
     confuse
     gst-python
@@ -76,7 +72,7 @@ python3Packages.buildPythonApplication {
   nativeBuildInputs = [
     gobject-introspection
     sphinxHook
-  ];
+  ] ++ extraNativeBuildInputs;
 
   buildInputs = [
   ] ++ (with gst_all_1; [
@@ -93,24 +89,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,17 +96,17 @@ python3Packages.buildPythonApplication {
   ];
 
   nativeCheckInputs = with python3Packages; [
-    pytest
+    pytestCheckHook
     mock
     rarfile
     responses
   ] ++ pluginWrapperBins;
 
   disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins));
+  inherit disabledTests;
 
-  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 +118,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 +132,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; {