2022-01-15 00:20:08 +00:00
|
|
|
{ lib
|
|
|
|
, home-assistant
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
# some components' tests have additional dependencies
|
|
|
|
extraCheckInputs = with home-assistant.python.pkgs; {
|
2022-04-06 17:12:44 +00:00
|
|
|
alexa = [ av ];
|
|
|
|
camera = [ av ];
|
2022-01-15 00:20:08 +00:00
|
|
|
cloud = [ mutagen ];
|
|
|
|
config = [ pydispatcher ];
|
2022-04-06 17:12:44 +00:00
|
|
|
generic = [ av ];
|
2022-01-15 00:20:08 +00:00
|
|
|
google_translate = [ mutagen ];
|
2022-03-02 19:25:38 +00:00
|
|
|
lovelace = [ PyChromecast ];
|
2022-04-06 17:12:44 +00:00
|
|
|
nest = [ av ];
|
2022-03-02 19:25:38 +00:00
|
|
|
onboarding = [ pymetno radios rpi-bad-power ];
|
2022-06-01 16:49:28 +00:00
|
|
|
raspberry_pi = [ rpi-bad-power ];
|
2022-04-17 17:05:47 +00:00
|
|
|
tomorrowio = [ pyclimacell ];
|
2022-02-09 18:57:58 +00:00
|
|
|
version = [ aioaseko ];
|
2022-01-15 00:20:08 +00: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 19:25:38 +00: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 00:20:08 +00: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 19:25:38 +00:00
|
|
|
disabledTests = old.disabledTests ++ extraDisabledTests.${component} or [];
|
2022-01-15 00:20:08 +00:00
|
|
|
disabledTestPaths = old.disabledTestPaths ++ extraDisabledTestPaths.${component} or [ ];
|
|
|
|
|
2022-04-14 00:54:53 +00:00
|
|
|
# components are more often racy than the core
|
|
|
|
dontUsePytestXdist = true;
|
|
|
|
|
2022-01-15 00:20:08 +00:00
|
|
|
pytestFlagsArray = lib.remove "tests" old.pytestFlagsArray
|
2022-04-14 00:54:53 +00:00
|
|
|
++ [ "--numprocesses=4" ]
|
2022-01-15 00:20:08 +00:00
|
|
|
++ extraPytestFlagsArray.${component} or [ ]
|
|
|
|
++ [ "tests/components/${component}" ];
|
|
|
|
|
2022-02-02 20:53:50 +00:00
|
|
|
preCheck = old.preCheck + lib.optionalString (builtins.elem component [ "emulated_hue" "songpal" "system_log" ]) ''
|
2022-01-15 00:20:08 +00:00
|
|
|
patch -p1 < ${./patches/tests-mock-source-ip.patch}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = old.meta // {
|
|
|
|
broken = lib.elem component [
|
2022-04-06 17:12:44 +00:00
|
|
|
"bsblan"
|
2022-02-02 20:53:50 +00:00
|
|
|
"dnsip"
|
2022-04-06 17:12:44 +00:00
|
|
|
"efergy"
|
|
|
|
"ssdp"
|
|
|
|
"subaru"
|
2022-01-15 00:20:08 +00:00
|
|
|
];
|
|
|
|
# upstream only tests on Linux, so do we.
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
)) home-assistant.supportedComponentsWithTests)
|