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
wip/yesman
Martin Weinelt 3 years ago
parent af4b72b618
commit b85dd8136e
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
  1. 8
      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 = {

Loading…
Cancel
Save