From b85dd8136e96022a4bbfa8c1204d0326fe4bf133 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 7 Apr 2021 01:41:57 +0200 Subject: [PATCH] home-assistant: error out if enabled component test does not exist Unfortunately enabling xdist hides the error away and the tests fail abruptly with no clear indication of what went wrong. Only after disabling xdist (`-n auto`, `--dist loadfile`) you would see > ERROR: file or directory not found: tests/components/openhome https://github.com/NixOS/nixpkgs/pull/118453#issuecomment-814491608 --- pkgs/servers/home-assistant/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 2ae7a6c33fa..407bac84b5a 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -383,6 +383,14 @@ in with py.pkgs; buildPythonApplication rec { preCheck = '' # the tests require the existance of a media dir mkdir /build/media + + # error out when component test directory is missing, otherwise hidden by xdist execution :( + for component in ${lib.concatStringsSep " " (map lib.escapeShellArg componentTests)}; do + test -d "tests/components/$component" || { + >2& echo "ERROR: Tests for component '$component' were enabled, but they do not exist!" + exit 1 + } + done ''; passthru = {