mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
beets{,-unstable}: use pytestCheckHook; small reformattings
This commit is contained in:
parent
377a39f0a2
commit
fa95aced90
@ -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; {
|
||||
|
Loading…
Reference in New Issue
Block a user