nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 home-assistant,
4}:
5
6let
7 getComponentDeps = component: home-assistant.getPackages component home-assistant.python.pkgs;
8
9 # some components' tests have additional dependencies
10 extraCheckInputs = with home-assistant.python.pkgs; {
11 abode = getComponentDeps "camera";
12 agent_dvr = getComponentDeps "camera";
13 air_quality = getComponentDeps "camera" ++ getComponentDeps "conversation";
14 alexa = getComponentDeps "cloud" ++ getComponentDeps "frontend" ++ getComponentDeps "stream";
15 android_ip_webcam = getComponentDeps "camera";
16 anthropic = getComponentDeps "ai_task";
17 assist_pipeline = getComponentDeps "frontend";
18 automation = getComponentDeps "frontend" ++ getComponentDeps "mobile_app";
19 axis = getComponentDeps "camera" ++ getComponentDeps "deconz";
20 blink = getComponentDeps "camera";
21 bthome = getComponentDeps "frontend";
22 buienradar = getComponentDeps "camera";
23 camera = getComponentDeps "conversation" ++ getComponentDeps "stream";
24 canary = getComponentDeps "camera";
25 climate = getComponentDeps "conversation";
26 color_extractor = getComponentDeps "camera" ++ getComponentDeps "conversation";
27 deconz = getComponentDeps "frontend";
28 demo = getComponentDeps "camera";
29 device_tracker = getComponentDeps "conversation";
30 dialogflow = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
31 dlib_face_detect = getComponentDeps "image_processing";
32 dlib_face_identify = getComponentDeps "image_processing";
33 doorbird = getComponentDeps "camera";
34 dremel_3d_printer = getComponentDeps "camera";
35 elevenlabs = getComponentDeps "tts";
36 elkm1 = getComponentDeps "frontend";
37 emulated_hue = getComponentDeps "conversation" ++ [
38 defusedxml
39 ];
40 emulated_kasa = getComponentDeps "camera" ++ getComponentDeps "conversation";
41 environment_canada = getComponentDeps "camera";
42 esphome = getComponentDeps "camera";
43 fan = getComponentDeps "conversation";
44 foscam = getComponentDeps "camera";
45 freebox = getComponentDeps "camera";
46 fully_kiosk = getComponentDeps "camera";
47 gardena_bluetooth = getComponentDeps "husqvarna_automower_ble";
48 geofency = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
49 google_assistant = getComponentDeps "conversation";
50 google_assistant_sdk = getComponentDeps "conversation" ++ getComponentDeps "frontend";
51 google_cloud = getComponentDeps "tts";
52 google_drive = getComponentDeps "frontend";
53 google_generative_ai_conversation = getComponentDeps "ai_task";
54 google_translate = getComponentDeps "tts";
55 govee_ble = [
56 ibeacon-ble
57 ];
58 gpslogger = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
59 group = getComponentDeps "camera" ++ getComponentDeps "conversation";
60 hassio = getComponentDeps "frontend" ++ getComponentDeps "homeassistant_yellow";
61 homeassistant = getComponentDeps "camera" ++ getComponentDeps "conversation";
62 homeassistant_connect_zbt2 = getComponentDeps "zha";
63 homeassistant_hardware = getComponentDeps "otbr" ++ getComponentDeps "zha";
64 homeassistant_sky_connect = getComponentDeps "zha";
65 homeassistant_yellow = getComponentDeps "zha";
66 homekit = getComponentDeps "conversation" ++ getComponentDeps "frontend";
67 homekit_controller = getComponentDeps "camera";
68 http = getComponentDeps "cloud" ++ getComponentDeps "frontend";
69 humidifier = getComponentDeps "conversation";
70 hyperion = getComponentDeps "camera";
71 ifttt = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
72 image_processing = getComponentDeps "conversation";
73 intent = getComponentDeps "conversation";
74 light = getComponentDeps "conversation";
75 local_file = getComponentDeps "camera";
76 locative = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
77 logbook = getComponentDeps "alexa";
78 lovelace = [
79 pychromecast
80 ];
81 lutron_caseta = getComponentDeps "frontend";
82 mailgun = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
83 marytts = getComponentDeps "tts";
84 media_player = getComponentDeps "camera" ++ getComponentDeps "conversation";
85 microsoft = getComponentDeps "tts";
86 microsoft_face_detect = getComponentDeps "conversation";
87 microsoft_face_identify = getComponentDeps "conversation";
88 miele = getComponentDeps "cloud";
89 mjpeg = getComponentDeps "camera";
90 mobile_app = getComponentDeps "frontend";
91 mopeka = getComponentDeps "switchbot";
92 motioneye = getComponentDeps "camera";
93 mqtt = getComponentDeps "camera";
94 nest = getComponentDeps "camera" ++ [
95 av
96 ];
97 number = getComponentDeps "conversation";
98 octoprint = getComponentDeps "camera";
99 ollama = getComponentDeps "ai_task";
100 onboarding = getComponentDeps "tts" ++ [
101 pymetno
102 radios
103 rpi-bad-power
104 ];
105 onvif = getComponentDeps "camera";
106 open_router = getComponentDeps "ai_task";
107 openai_conversation = getComponentDeps "camera";
108 openalpr_cloud = getComponentDeps "camera" ++ getComponentDeps "conversation";
109 prosegur = getComponentDeps "camera";
110 prusalink = getComponentDeps "camera";
111 push = getComponentDeps "camera";
112 raspberry_pi = [
113 rpi-bad-power
114 ];
115 reolink = getComponentDeps "stream";
116 ring = getComponentDeps "camera";
117 roku = getComponentDeps "camera";
118 rss_feed_template = [
119 defusedxml
120 ];
121 script = getComponentDeps "frontend" ++ getComponentDeps "mobile_app";
122 sensor = getComponentDeps "camera" ++ getComponentDeps "conversation";
123 shelly = getComponentDeps "frontend" ++ getComponentDeps "switchbot";
124 sighthound = getComponentDeps "conversation" ++ getComponentDeps "image_processing";
125 skybell = getComponentDeps "camera";
126 sleep_as_android = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
127 songpal = [
128 isal
129 ];
130 swiss_public_transport = getComponentDeps "cookidoo";
131 switch = getComponentDeps "camera" ++ getComponentDeps "conversation";
132 switch_as_x = getComponentDeps "camera" ++ getComponentDeps "conversation";
133 synology_dsm = getComponentDeps "camera";
134 system_log = [
135 isal
136 ];
137 tasmota = getComponentDeps "camera";
138 todo = getComponentDeps "conversation";
139 traccar = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
140 trafikverket_camera = getComponentDeps "camera";
141 tts = getComponentDeps "conversation";
142 tuya = getComponentDeps "camera";
143 twilio = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera";
144 unifiprotect = getComponentDeps "camera";
145 universal = getComponentDeps "camera" ++ getComponentDeps "conversation";
146 uvc = getComponentDeps "camera";
147 vivotek = getComponentDeps "camera";
148 voicerss = getComponentDeps "tts";
149 weather = getComponentDeps "conversation";
150 websocket_api = getComponentDeps "camera" ++ getComponentDeps "conversation";
151 xiaomi_miio = [
152 arrow
153 ];
154 yandextts = getComponentDeps "tts";
155 yolink = getComponentDeps "cloud";
156 zeroconf = getComponentDeps "shelly";
157 zha = getComponentDeps "deconz" ++ getComponentDeps "frontend";
158 zwave_js = getComponentDeps "frontend";
159 };
160
161 extraDisabledTestPaths = {
162 jellyfin = [
163 # AssertionError: assert 'audio/x-flac' == 'audio/flac'
164 "tests/components/jellyfin/test_media_source.py::test_resolve"
165 "tests/components/jellyfin/test_media_source.py::test_audio_codec_resolve"
166 "tests/components/jellyfin/test_media_source.py::test_music_library"
167 ];
168 minecraft_server = [
169 # FileNotFoundError: [Errno 2] No such file or directory: '/etc/resolv.conf'
170 "tests/components/minecraft_server/test_binary_sensor.py"
171 "tests/components/minecraft_server/test_diagnostics.py"
172 "tests/components/minecraft_server/test_init.py"
173 "tests/components/minecraft_server/test_sensor.py"
174 ];
175 modem_callerid = [
176 # aioserial mock produces wrong state
177 "tests/components/modem_callerid/test_init.py::test_setup_entry"
178 ];
179 nzbget = [
180 # type assertion fails due to introduction of parameterized type
181 "tests/components/nzbget/test_config_flow.py::test_user_form"
182 "tests/components/nzbget/test_config_flow.py::test_user_form_show_advanced_options"
183 "tests/components/nzbget/test_config_flow.py::test_user_form_cannot_connect"
184 "tests/components/nzbget/test_init.py::test_async_setup_raises_entry_not_ready"
185 ];
186 overseerr = [
187 # imports broken future module
188 "tests/components/overseerr/test_event.py"
189 ];
190 systemmonitor = [
191 # sandbox doesn't grant access to /sys/class/power_supply
192 "tests/components/systemmonitor/test_config_flow.py::test_add_and_remove_processes"
193 ];
194 youtube = [
195 # outdated snapshot
196 "tests/components/youtube/test_sensor.py::test_sensor"
197 ];
198 };
199
200 extraDisabledTests = {
201 conversation = [
202 # intent fixture mismatch
203 "test_error_no_device_on_floor"
204 ];
205 homewizard = [
206 # Messages don't match expected due to a change in Homewizard's outputs
207 "test_identify_button"
208 "test_number_entities"
209 "test_select_request_error"
210 "test_switch_entities"
211 ];
212 sensor = [
213 # Failed: Translation not found for sensor
214 "test_validate_unit_change_convertible"
215 "test_validate_statistics_unit_change_no_device_class"
216 "test_validate_statistics_state_class_removed"
217 "test_validate_statistics_state_class_removed_issue_cleaned_up"
218 "test_validate_statistics_unit_change_no_conversion"
219 "test_validate_statistics_unit_change_equivalent_units_2"
220 "test_update_statistics_issues"
221 "test_validate_statistics_mean_type_changed"
222 ];
223 shell_command = [
224 # tries to retrieve file from github
225 "test_non_text_stdout_capture"
226 ];
227 zeroconf = [
228 # multicast socket bind, not possible in the sandbox
229 "test_subscribe_discovery"
230 ];
231 };
232in
233lib.listToAttrs (
234 map (
235 component:
236 lib.nameValuePair component (
237 home-assistant.overridePythonAttrs (old: {
238 pname = "homeassistant-test-${component}";
239 pyproject = false;
240
241 dontBuild = true;
242 dontInstall = true;
243
244 nativeCheckInputs =
245 old.requirementsTest
246 ++ home-assistant.getPackages component home-assistant.python.pkgs
247 ++ extraCheckInputs.${component} or [ ];
248
249 disabledTests = extraDisabledTests.${component} or [ ];
250 disabledTestPaths = extraDisabledTestPaths.${component} or [ ];
251
252 # components are more often racy than the core
253 dontUsePytestXdist = true;
254
255 enabledTestPaths = [ "tests/components/${component}" ];
256
257 meta = old.meta // {
258 broken = lib.elem component [ ];
259 # upstream only tests on Linux, so do we.
260 platforms = lib.platforms.linux;
261 };
262 })
263 )
264 ) home-assistant.supportedComponentsWithTests
265)