From c7916a507b6657f82a42741790a86e66f7783480 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Sun, 19 Nov 2023 22:50:28 +0000 Subject: [PATCH] beets-minimal: fix building with no plugins pytestCheckHook throws an error for non-existent disabled tests. This commit removes any non-existent tests from the disabled tests list. --- pkgs/tools/audio/beets/builtin-plugins.nix | 82 +++++++++++++++------- pkgs/tools/audio/beets/common.nix | 8 +-- 2 files changed, 60 insertions(+), 30 deletions(-) diff --git a/pkgs/tools/audio/beets/builtin-plugins.nix b/pkgs/tools/audio/beets/builtin-plugins.nix index 1fef39ef72f5..e3bc10210441 100644 --- a/pkgs/tools/audio/beets/builtin-plugins.nix +++ b/pkgs/tools/audio/beets/builtin-plugins.nix @@ -17,20 +17,32 @@ }; acousticbrainz.propagatedBuildInputs = [ python3Packages.requests ]; albumtypes = { }; - aura.propagatedBuildInputs = with python3Packages; [ flask pillow ]; - badfiles.wrapperBins = [ mp3val flac ]; + aura = { + propagatedBuildInputs = with python3Packages; [ flask pillow ]; + testPaths = [ ]; + }; + badfiles = { + testPaths = [ ]; + wrapperBins = [ mp3val flac ]; + }; bareasc = { }; beatport.propagatedBuildInputs = [ python3Packages.requests-oauthlib ]; - bench = { }; - bpd = { }; - bpm = { }; - bpsync = { }; + bench.testPaths = [ ]; + bpd.testPaths = [ ]; + bpm.testPaths = [ ]; + bpsync.testPaths = [ ]; bucket = { }; - chroma.propagatedBuildInputs = [ python3Packages.pyacoustid ]; + chroma = { + propagatedBuildInputs = [ python3Packages.pyacoustid ]; + testPaths = [ ]; + }; convert.wrapperBins = [ ffmpeg ]; - deezer.propagatedBuildInputs = [ python3Packages.requests ]; + deezer = { + propagatedBuildInputs = [ python3Packages.requests ]; + testPaths = [ ]; + }; discogs.propagatedBuildInputs = with python3Packages; [ discogs-client requests ]; - duplicates = { }; + duplicates.testPaths = [ ]; edit = { }; embedart = { propagatedBuildInputs = with python3Packages; [ pillow ]; @@ -43,32 +55,44 @@ wrapperBins = [ imagemagick ]; }; filefilter = { }; - fish = { }; - freedesktop = { }; - fromfilename = { }; + fish.testPaths = [ ]; + freedesktop.testPaths = [ ]; + fromfilename.testPaths = [ ]; ftintitle = { }; - fuzzy = { }; - gmusic = { }; + fuzzy.testPaths = [ ]; + gmusic.testPaths = [ ]; hook = { }; ihate = { }; importadded = { }; importfeeds = { }; info = { }; - inline = { }; + inline.testPaths = [ ]; ipfs = { }; keyfinder.wrapperBins = [ keyfinder-cli ]; - kodiupdate.propagatedBuildInputs = [ python3Packages.requests ]; + kodiupdate = { + propagatedBuildInputs = [ python3Packages.requests ]; + testPaths = [ ]; + }; lastgenre.propagatedBuildInputs = [ python3Packages.pylast ]; - lastimport.propagatedBuildInputs = [ python3Packages.pylast ]; - loadext.propagatedBuildInputs = [ python3Packages.requests ]; + lastimport = { + propagatedBuildInputs = [ python3Packages.pylast ]; + testPaths = [ ]; + }; + loadext = { + propagatedBuildInputs = [ python3Packages.requests ]; + testPaths = [ ]; + }; lyrics.propagatedBuildInputs = [ python3Packages.beautifulsoup4 ]; - mbcollection = { }; + mbcollection.testPaths = [ ]; mbsubmit = { }; mbsync = { }; metasync = { }; - missing = { }; + missing.testPaths = [ ]; mpdstats.propagatedBuildInputs = [ python3Packages.mpd2 ]; - mpdupdate.propagatedBuildInputs = [ python3Packages.mpd2 ]; + mpdupdate = { + propagatedBuildInputs = [ python3Packages.mpd2 ]; + testPaths = [ ]; + }; parentwork = { }; permissions = { }; play = { }; @@ -76,12 +100,18 @@ plexupdate = { }; random = { }; replaygain.wrapperBins = [ aacgain ffmpeg mp3gain ]; - rewrite = { }; - scrub = { }; + rewrite.testPaths= [ ]; + scrub.testPaths = [ ]; smartplaylist = { }; - sonosupdate.propagatedBuildInputs = [ python3Packages.soco ]; + sonosupdate = { + propagatedBuildInputs = [ python3Packages.soco ]; + testPaths = [ ]; + }; spotify = { }; - subsonicplaylist.propagatedBuildInputs = [ python3Packages.requests ]; + subsonicplaylist = { + propagatedBuildInputs = [ python3Packages.requests ]; + testPaths = [ ]; + }; subsonicupdate.propagatedBuildInputs = [ python3Packages.requests ]; the = { }; thumbnails = { @@ -89,7 +119,7 @@ wrapperBins = [ imagemagick ]; }; types.testPaths = [ "test/test_types_plugin.py" ]; - unimported = { }; + unimported.testPaths = [ ]; web.propagatedBuildInputs = [ python3Packages.flask ]; zero = { }; } diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index 37faff29c728..d4e589f098e4 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -36,12 +36,12 @@ let inherit (lib) attrNames attrValues concatMap; - mkPlugin = { enable ? !disableAllPlugins, builtin ? false, propagatedBuildInputs ? [ ], testPaths ? [ ], wrapperBins ? [ ] }: { - inherit enable builtin propagatedBuildInputs testPaths wrapperBins; + mkPlugin = { name, enable ? !disableAllPlugins, builtin ? false, propagatedBuildInputs ? [ ], testPaths ? [ "test/test_${name}.py" ], wrapperBins ? [ ] }: { + inherit name enable builtin propagatedBuildInputs testPaths wrapperBins; }; basePlugins = lib.mapAttrs (_: a: { builtin = true; } // a) (import ./builtin-plugins.nix inputs); - allPlugins = lib.mapAttrs (_: mkPlugin) (lib.recursiveUpdate basePlugins pluginOverrides); + allPlugins = lib.mapAttrs (n: a: mkPlugin { name = n; } // a) (lib.recursiveUpdate basePlugins pluginOverrides); builtinPlugins = lib.filterAttrs (_: p: p.builtin) allPlugins; enabledPlugins = lib.filterAttrs (_: p: p.enable) allPlugins; disabledPlugins = lib.filterAttrs (_: p: !p.enable) allPlugins; @@ -102,7 +102,7 @@ python3Packages.buildPythonApplication { responses ] ++ pluginWrapperBins; - disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins)); + disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (_: v: v.testPaths) disabledPlugins)); inherit disabledTests; # Perform extra "sanity checks", before running pytest tests.