2022-01-19 23:45:15 +00:00
|
|
|
{ lib
|
|
|
|
, home-assistant
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
# some components' tests have additional dependencies
|
|
|
|
extraCheckInputs = with home-assistant.python.pkgs; {
|
2024-01-13 08:15:51 +00:00
|
|
|
airzone_cloud = [
|
|
|
|
aioairzone
|
|
|
|
];
|
|
|
|
bluetooth = [
|
|
|
|
pyswitchbot
|
|
|
|
];
|
|
|
|
govee_ble = [
|
|
|
|
ibeacon-ble
|
|
|
|
];
|
|
|
|
lovelace = [
|
|
|
|
pychromecast
|
|
|
|
];
|
|
|
|
matrix = [
|
|
|
|
pydantic
|
|
|
|
];
|
|
|
|
mopeka = [
|
|
|
|
pyswitchbot
|
|
|
|
];
|
|
|
|
onboarding = [
|
|
|
|
pymetno
|
|
|
|
radios
|
|
|
|
rpi-bad-power
|
|
|
|
];
|
|
|
|
raspberry_pi = [
|
|
|
|
rpi-bad-power
|
|
|
|
];
|
|
|
|
shelly = [
|
|
|
|
pyswitchbot
|
|
|
|
];
|
|
|
|
tilt_ble = [
|
|
|
|
ibeacon-ble
|
|
|
|
];
|
|
|
|
xiaomi_miio = [
|
|
|
|
arrow
|
|
|
|
];
|
|
|
|
zha = [
|
|
|
|
pydeconz
|
|
|
|
];
|
2022-01-19 23:45:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extraDisabledTestPaths = {
|
|
|
|
};
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
extraDisabledTests = {
|
2024-01-13 08:15:51 +00:00
|
|
|
private_ble_device = [
|
|
|
|
# AssertionError: assert '90' == '90.0'
|
|
|
|
"test_estimated_broadcast_interval"
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
|
|
|
shell_command = [
|
|
|
|
# tries to retrieve file from github
|
|
|
|
"test_non_text_stdout_capture"
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
sma = [
|
|
|
|
# missing operating_status attribute in entity
|
|
|
|
"test_sensor_entities"
|
|
|
|
];
|
2022-03-05 16:20:37 +00:00
|
|
|
};
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
extraPytestFlagsArray = {
|
2024-01-13 08:15:51 +00:00
|
|
|
cloud = [
|
|
|
|
# Tries to connect to alexa-api.nabucasa.com:443
|
|
|
|
"--deselect tests/components/cloud/test_http_api.py::test_websocket_update_preferences_alexa_report_state"
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
2022-10-06 18:32:54 +00:00
|
|
|
dnsip = [
|
2023-04-12 12:48:02 +00:00
|
|
|
# Tries to resolve DNS entries
|
2022-10-06 18:32:54 +00:00
|
|
|
"--deselect tests/components/dnsip/test_config_flow.py::test_options_flow"
|
|
|
|
];
|
2023-08-04 22:07:22 +00:00
|
|
|
jellyfin = [
|
|
|
|
# AssertionError: assert 'audio/x-flac' == 'audio/flac'
|
|
|
|
"--deselect tests/components/jellyfin/test_media_source.py::test_resolve"
|
|
|
|
# AssertionError: assert [+ received] == [- snapshot]
|
|
|
|
"--deselect tests/components/jellyfin/test_media_source.py::test_music_library"
|
|
|
|
];
|
2022-11-04 12:27:35 +00:00
|
|
|
modem_callerid = [
|
|
|
|
# aioserial mock produces wrong state
|
|
|
|
"--deselect tests/components/modem_callerid/test_init.py::test_setup_entry"
|
|
|
|
];
|
2024-04-21 15:54:59 +00:00
|
|
|
velux = [
|
|
|
|
# uses unmocked sockets
|
|
|
|
"--deselect tests/components/velux/test_config_flow.py::test_user_success"
|
|
|
|
"--deselect tests/components/velux/test_config_flow.py::test_import_valid_config"
|
|
|
|
];
|
2022-01-19 23:45:15 +00:00
|
|
|
};
|
|
|
|
in lib.listToAttrs (map (component: lib.nameValuePair component (
|
|
|
|
home-assistant.overridePythonAttrs (old: {
|
|
|
|
pname = "homeassistant-test-${component}";
|
2022-09-30 11:47:45 +00:00
|
|
|
format = "other";
|
2022-01-19 23:45:15 +00:00
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
dontInstall = true;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = old.nativeCheckInputs
|
2022-01-19 23:45:15 +00:00
|
|
|
++ home-assistant.getPackages component home-assistant.python.pkgs
|
|
|
|
++ extraCheckInputs.${component} or [ ];
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
disabledTests = old.disabledTests or [] ++ extraDisabledTests.${component} or [];
|
|
|
|
disabledTestPaths = old.disabledTestPaths or [] ++ extraDisabledTestPaths.${component} or [ ];
|
2022-01-19 23:45:15 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
# components are more often racy than the core
|
|
|
|
dontUsePytestXdist = true;
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
pytestFlagsArray = lib.remove "tests" old.pytestFlagsArray
|
|
|
|
++ extraPytestFlagsArray.${component} or [ ]
|
|
|
|
++ [ "tests/components/${component}" ];
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
preCheck = old.preCheck + lib.optionalString (builtins.elem component [ "emulated_hue" "songpal" "system_log" ]) ''
|
2022-01-19 23:45:15 +00:00
|
|
|
patch -p1 < ${./patches/tests-mock-source-ip.patch}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = old.meta // {
|
|
|
|
broken = lib.elem component [
|
2023-11-16 04:20:00 +00:00
|
|
|
# pinned version incompatible with urllib3>=2.0
|
|
|
|
"telegram_bot"
|
2024-01-13 08:15:51 +00:00
|
|
|
# depends on telegram_bot
|
|
|
|
"telegram"
|
2022-01-19 23:45:15 +00:00
|
|
|
];
|
|
|
|
# upstream only tests on Linux, so do we.
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
)) home-assistant.supportedComponentsWithTests)
|