6 # some components' tests have additional dependencies
7 extraCheckInputs = with home-assistant.python.pkgs; {
11 androidtv = home-assistant.getPackages "asuswrt" home-assistant.python.pkgs;
49 extraDisabledTestPaths = {
52 extraDisabledTests = {
54 # AssertionError: assert 2 == 1 (Expected two calls, got one)
55 "test_binary_sensor_async_setup_entry"
58 # fails to load the hardware component
59 "test_device_registry_calls"
61 husqvarna_automower = [
63 "test_device_diagnostics"
66 # call not happening, likely due to timezone issues
70 # tries to retrieve file from github
71 "test_non_text_stdout_capture"
74 # missing operating_status attribute in entity
75 "test_sensor_entities"
79 "test_render_template_with_timeout"
83 extraPytestFlagsArray = {
85 # Tries to connect to alexa-api.nabucasa.com:443
86 "--deselect tests/components/cloud/test_http_api.py::test_websocket_update_preferences_alexa_report_state"
89 # Tries to resolve DNS entries
90 "--deselect tests/components/dnsip/test_config_flow.py::test_options_flow"
93 # AssertionError: assert 'audio/x-flac' == 'audio/flac'
94 "--deselect tests/components/jellyfin/test_media_source.py::test_resolve"
95 "--deselect tests/components/jellyfin/test_media_source.py::test_audio_codec_resolve"
96 # AssertionError: assert [+ received] == [- snapshot]
97 "--deselect tests/components/jellyfin/test_media_source.py::test_music_library"
100 # aioserial mock produces wrong state
101 "--deselect tests/components/modem_callerid/test_init.py::test_setup_entry"
104 # uses unmocked sockets
105 "--deselect tests/components/velux/test_config_flow.py::test_user_success"
106 "--deselect tests/components/velux/test_config_flow.py::test_import_valid_config"
109 in lib.listToAttrs (map (component: lib.nameValuePair component (
110 home-assistant.overridePythonAttrs (old: {
111 pname = "homeassistant-test-${component}";
118 nativeCheckInputs = old.nativeCheckInputs
119 ++ home-assistant.getPackages component home-assistant.python.pkgs
120 ++ extraCheckInputs.${component} or [ ];
122 disabledTests = old.disabledTests or [] ++ extraDisabledTests.${component} or [];
123 disabledTestPaths = old.disabledTestPaths or [] ++ extraDisabledTestPaths.${component} or [ ];
125 # components are more often racy than the core
126 dontUsePytestXdist = true;
128 pytestFlagsArray = lib.remove "tests" old.pytestFlagsArray
129 ++ extraPytestFlagsArray.${component} or [ ]
130 ++ [ "tests/components/${component}" ];
132 preCheck = old.preCheck + lib.optionalString (builtins.elem component [ "emulated_hue" "songpal" "system_log" ]) ''
133 patch -p1 < ${./patches/tests-mock-source-ip.patch}
137 broken = lib.elem component [ ];
138 # upstream only tests on Linux, so do we.
139 platforms = lib.platforms.linux;
142 )) home-assistant.supportedComponentsWithTests)