2022-01-15 01:20:08 +01:00
|
|
|
{ lib
|
|
|
|
, home-assistant
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
# some components' tests have additional dependencies
|
|
|
|
extraCheckInputs = with home-assistant.python.pkgs; {
|
2022-04-06 19:12:44 +02:00
|
|
|
alexa = [ av ];
|
|
|
|
camera = [ av ];
|
2022-01-15 01:20:08 +01:00
|
|
|
cloud = [ mutagen ];
|
|
|
|
config = [ pydispatcher ];
|
2022-04-06 19:12:44 +02:00
|
|
|
generic = [ av ];
|
2022-01-15 01:20:08 +01:00
|
|
|
google_translate = [ mutagen ];
|
2022-03-02 20:25:38 +01:00
|
|
|
lovelace = [ PyChromecast ];
|
2022-04-06 19:12:44 +02:00
|
|
|
nest = [ av ];
|
2022-03-02 20:25:38 +01:00
|
|
|
onboarding = [ pymetno radios rpi-bad-power ];
|
2022-04-17 19:05:47 +02:00
|
|
|
tomorrowio = [ pyclimacell ];
|
2022-02-09 19:57:58 +01:00
|
|
|
version = [ aioaseko ];
|
2022-01-15 01:20:08 +01:00
|
|
|
voicerss = [ mutagen ];
|
|
|
|
yandextts = [ mutagen ];
|
|
|
|
zha = [ pydeconz ];
|
|
|
|
zwave_js = [ homeassistant-pyozw ];
|
|
|
|
};
|
|
|
|
|
|
|
|
extraDisabledTestPaths = {
|
|
|
|
tado = [
|
|
|
|
# tado/test_{climate,water_heater}.py: Tries to connect to my.tado.com
|
|
|
|
"tests/components/tado/test_climate.py"
|
|
|
|
"tests/components/tado/test_water_heater.py"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2022-03-02 20:25:38 +01:00
|
|
|
extraDisabledTests = {
|
|
|
|
roku = [
|
|
|
|
# homeassistant.components.roku.media_player:media_player.py:428 Media type music is not supported with format None (mime: audio/x-matroska)
|
|
|
|
"test_services_play_media_audio"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2022-01-15 01:20:08 +01:00
|
|
|
extraPytestFlagsArray = {
|
|
|
|
asuswrt = [
|
|
|
|
# asuswrt/test_config_flow.py: Sandbox network limitations, fails with unexpected error
|
|
|
|
"--deselect tests/components/asuswrt/test_config_flow.py::test_on_connect_failed"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
in lib.listToAttrs (map (component: lib.nameValuePair component (
|
|
|
|
home-assistant.overridePythonAttrs (old: {
|
|
|
|
pname = "homeassistant-test-${component}";
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
dontInstall = true;
|
|
|
|
|
|
|
|
checkInputs = old.checkInputs
|
|
|
|
++ home-assistant.getPackages component home-assistant.python.pkgs
|
|
|
|
++ extraCheckInputs.${component} or [ ];
|
|
|
|
|
2022-03-02 20:25:38 +01:00
|
|
|
disabledTests = old.disabledTests ++ extraDisabledTests.${component} or [];
|
2022-01-15 01:20:08 +01:00
|
|
|
disabledTestPaths = old.disabledTestPaths ++ extraDisabledTestPaths.${component} or [ ];
|
|
|
|
|
2022-04-14 02:54:53 +02:00
|
|
|
# components are more often racy than the core
|
|
|
|
dontUsePytestXdist = true;
|
|
|
|
|
2022-01-15 01:20:08 +01:00
|
|
|
pytestFlagsArray = lib.remove "tests" old.pytestFlagsArray
|
2022-04-14 02:54:53 +02:00
|
|
|
++ [ "--numprocesses=4" ]
|
2022-01-15 01:20:08 +01:00
|
|
|
++ extraPytestFlagsArray.${component} or [ ]
|
|
|
|
++ [ "tests/components/${component}" ];
|
|
|
|
|
2022-02-02 21:53:50 +01:00
|
|
|
preCheck = old.preCheck + lib.optionalString (builtins.elem component [ "emulated_hue" "songpal" "system_log" ]) ''
|
2022-01-15 01:20:08 +01:00
|
|
|
patch -p1 < ${./patches/tests-mock-source-ip.patch}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = old.meta // {
|
|
|
|
broken = lib.elem component [
|
|
|
|
"airtouch4"
|
2022-04-06 19:12:44 +02:00
|
|
|
"bsblan"
|
2022-02-02 21:53:50 +01:00
|
|
|
"dnsip"
|
2022-04-06 19:12:44 +02:00
|
|
|
"efergy"
|
|
|
|
"ssdp"
|
|
|
|
"subaru"
|
2022-01-15 01:20:08 +01:00
|
|
|
];
|
|
|
|
# upstream only tests on Linux, so do we.
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
)) home-assistant.supportedComponentsWithTests)
|