Commit fa95aced authored by Doron Behar's avatar Doron Behar
Browse files

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

parent 377a39f0
Loading
Loading
Loading
Loading
+16 −43
Original line number Diff line number Diff line
@@ -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,8 +135,7 @@ python3Packages.buildPythonApplication {

  passthru.tests.gstreamer = runCommand "beets-gstreamer-test" {
    meta.timeout = 60;
  }
  ''
  } ''
    set -euo pipefail
    export HOME=$(mktemp -d)
    mkdir $out
@@ -171,7 +145,6 @@ replaygain:
  backend: gstreamer
EOF

  echo $out/config.yaml
    ${beets}/bin/beet -c $out/config.yaml > /dev/null
  '';