Merge pull request #155060 from dotlambda/home-assistant-outsource-tests

home-assistant: outsource component tests

authored by Robert Schütz and committed by GitHub adde93f1 84926ba4

+719 -735
+37
pkgs/development/python-modules/rpi-bad-power/default.nix
···
··· 1 + { lib 2 + , buildPythonPackage 3 + , fetchFromGitHub 4 + , pytestCheckHook 5 + }: 6 + 7 + let 8 + pname = "rpi-bad-power"; 9 + version = "0.1.0"; 10 + in 11 + buildPythonPackage { 12 + inherit pname version; 13 + format = "pyproject"; 14 + 15 + src = fetchFromGitHub { 16 + owner = "shenxn"; 17 + repo = pname; 18 + rev = "v${version}"; 19 + hash = "sha256:1yvfz28blq4fdnn614n985vbs5hcw1gm3i9am53k410sfs7ilvkk"; 20 + }; 21 + 22 + pythonImportsCheck = [ 23 + "rpi_bad_power" 24 + ]; 25 + 26 + checkInputs = [ 27 + pytestCheckHook 28 + ]; 29 + 30 + meta = with lib; { 31 + description = "Python library to detect bad power supply on Raspberry Pi"; 32 + homepage = "https://github.com/shenxn/rpi-bad-power"; 33 + license = licenses.mit; 34 + maintainers = with maintainers; [ hexa ]; 35 + platforms = platforms.linux; 36 + }; 37 + }
+566 -1
pkgs/servers/home-assistant/component-packages.nix
··· 725 "rpi_gpio" = ps: with ps; [ ]; # missing inputs: RPi.GPIO 726 "rpi_gpio_pwm" = ps: with ps; [ ]; # missing inputs: pwmled 727 "rpi_pfio" = ps: with ps; [ ]; # missing inputs: pifacecommon pifacedigitalio 728 - "rpi_power" = ps: with ps; [ ]; # missing inputs: rpi-bad-power 729 "rpi_rf" = ps: with ps; [ ]; # missing inputs: RPi.GPIO rpi-rf 730 "rss_feed_template" = ps: with ps; [ aiohttp-cors ]; 731 "rtorrent" = ps: with ps; [ ]; ··· 1018 "zwave" = ps: with ps; [ homeassistant-pyozw pydispatcher ]; 1019 "zwave_js" = ps: with ps; [ aiohttp-cors pyserial pyudev zwave-js-server-python ]; 1020 }; 1021 }
··· 725 "rpi_gpio" = ps: with ps; [ ]; # missing inputs: RPi.GPIO 726 "rpi_gpio_pwm" = ps: with ps; [ ]; # missing inputs: pwmled 727 "rpi_pfio" = ps: with ps; [ ]; # missing inputs: pifacecommon pifacedigitalio 728 + "rpi_power" = ps: with ps; [ rpi-bad-power ]; 729 "rpi_rf" = ps: with ps; [ ]; # missing inputs: RPi.GPIO rpi-rf 730 "rss_feed_template" = ps: with ps; [ aiohttp-cors ]; 731 "rtorrent" = ps: with ps; [ ]; ··· 1018 "zwave" = ps: with ps; [ homeassistant-pyozw pydispatcher ]; 1019 "zwave_js" = ps: with ps; [ aiohttp-cors pyserial pyudev zwave-js-server-python ]; 1020 }; 1021 + # components listed in tests/components for which all dependencies are packaged 1022 + supportedComponentsWithTests = [ 1023 + "abode" 1024 + "accuweather" 1025 + "acmeda" 1026 + "adax" 1027 + "adguard" 1028 + "advantage_air" 1029 + "aemet" 1030 + "agent_dvr" 1031 + "air_quality" 1032 + "airly" 1033 + "airnow" 1034 + "airthings" 1035 + "airtouch4" 1036 + "airvisual" 1037 + "alarm_control_panel" 1038 + "alarmdecoder" 1039 + "alert" 1040 + "alexa" 1041 + "almond" 1042 + "ambee" 1043 + "amberelectric" 1044 + "ambiclimate" 1045 + "ambient_station" 1046 + "analytics" 1047 + "androidtv" 1048 + "apache_kafka" 1049 + "api" 1050 + "apple_tv" 1051 + "apprise" 1052 + "aprs" 1053 + "arcam_fmj" 1054 + "arlo" 1055 + "asuswrt" 1056 + "atag" 1057 + "august" 1058 + "aurora" 1059 + "auth" 1060 + "automation" 1061 + "awair" 1062 + "aws" 1063 + "axis" 1064 + "azure_devops" 1065 + "azure_event_hub" 1066 + "balboa" 1067 + "bayesian" 1068 + "binary_sensor" 1069 + "blackbird" 1070 + "blebox" 1071 + "blink" 1072 + "blueprint" 1073 + "bluetooth_le_tracker" 1074 + "bmw_connected_drive" 1075 + "bond" 1076 + "bosch_shc" 1077 + "braviatv" 1078 + "broadlink" 1079 + "brother" 1080 + "bsblan" 1081 + "buienradar" 1082 + "button" 1083 + "caldav" 1084 + "calendar" 1085 + "camera" 1086 + "canary" 1087 + "cast" 1088 + "cert_expiry" 1089 + "climacell" 1090 + "climate" 1091 + "cloud" 1092 + "cloudflare" 1093 + "color_extractor" 1094 + "comfoconnect" 1095 + "command_line" 1096 + "compensation" 1097 + "config" 1098 + "configurator" 1099 + "control4" 1100 + "conversation" 1101 + "coolmaster" 1102 + "coronavirus" 1103 + "counter" 1104 + "cover" 1105 + "crownstone" 1106 + "daikin" 1107 + "darksky" 1108 + "datadog" 1109 + "debugpy" 1110 + "deconz" 1111 + "default_config" 1112 + "demo" 1113 + "denonavr" 1114 + "derivative" 1115 + "device_automation" 1116 + "device_sun_light_trigger" 1117 + "device_tracker" 1118 + "devolo_home_control" 1119 + "devolo_home_network" 1120 + "dexcom" 1121 + "dhcp" 1122 + "dialogflow" 1123 + "directv" 1124 + "discovery" 1125 + "dlna_dmr" 1126 + "doorbird" 1127 + "dsmr" 1128 + "dte_energy_bridge" 1129 + "duckdns" 1130 + "dunehd" 1131 + "eafm" 1132 + "ecobee" 1133 + "econet" 1134 + "efergy" 1135 + "elgato" 1136 + "elkm1" 1137 + "emonitor" 1138 + "emulated_hue" 1139 + "emulated_kasa" 1140 + "emulated_roku" 1141 + "energy" 1142 + "enocean" 1143 + "enphase_envoy" 1144 + "environment_canada" 1145 + "epson" 1146 + "esphome" 1147 + "everlights" 1148 + "evil_genius_labs" 1149 + "ezviz" 1150 + "faa_delays" 1151 + "facebook" 1152 + "facebox" 1153 + "fail2ban" 1154 + "fan" 1155 + "feedreader" 1156 + "ffmpeg" 1157 + "fido" 1158 + "file" 1159 + "filesize" 1160 + "filter" 1161 + "fireservicerota" 1162 + "firmata" 1163 + "fjaraskupan" 1164 + "flick_electric" 1165 + "flipr" 1166 + "flo" 1167 + "flume" 1168 + "flunearyou" 1169 + "flux" 1170 + "flux_led" 1171 + "folder" 1172 + "folder_watcher" 1173 + "foobot" 1174 + "forecast_solar" 1175 + "foscam" 1176 + "freebox" 1177 + "freedns" 1178 + "freedompro" 1179 + "fritz" 1180 + "fritzbox" 1181 + "fritzbox_callmonitor" 1182 + "fronius" 1183 + "frontend" 1184 + "garages_amsterdam" 1185 + "gdacs" 1186 + "generic" 1187 + "generic_hygrostat" 1188 + "generic_thermostat" 1189 + "geo_json_events" 1190 + "geo_location" 1191 + "geo_rss_events" 1192 + "geofency" 1193 + "geonetnz_quakes" 1194 + "geonetnz_volcano" 1195 + "gios" 1196 + "glances" 1197 + "goalzero" 1198 + "gogogate2" 1199 + "google" 1200 + "google_assistant" 1201 + "google_domains" 1202 + "google_pubsub" 1203 + "google_translate" 1204 + "google_travel_time" 1205 + "google_wifi" 1206 + "gpslogger" 1207 + "graphite" 1208 + "gree" 1209 + "group" 1210 + "growatt_server" 1211 + "guardian" 1212 + "habitica" 1213 + "hangouts" 1214 + "harmony" 1215 + "hassio" 1216 + "hddtemp" 1217 + "heos" 1218 + "here_travel_time" 1219 + "hisense_aehw4a1" 1220 + "history" 1221 + "history_stats" 1222 + "hive" 1223 + "hlk_sw16" 1224 + "home_connect" 1225 + "home_plus_control" 1226 + "homeassistant" 1227 + "homekit" 1228 + "homekit_controller" 1229 + "homematic" 1230 + "homematicip_cloud" 1231 + "honeywell" 1232 + "html5" 1233 + "http" 1234 + "huawei_lte" 1235 + "hue" 1236 + "huisbaasje" 1237 + "humidifier" 1238 + "hunterdouglas_powerview" 1239 + "hvv_departures" 1240 + "hyperion" 1241 + "ialarm" 1242 + "iaqualink" 1243 + "icloud" 1244 + "ifttt" 1245 + "ign_sismologia" 1246 + "image" 1247 + "image_processing" 1248 + "imap_email_content" 1249 + "influxdb" 1250 + "input_boolean" 1251 + "input_datetime" 1252 + "input_number" 1253 + "input_select" 1254 + "input_text" 1255 + "insteon" 1256 + "integration" 1257 + "intent" 1258 + "intent_script" 1259 + "ios" 1260 + "iotawatt" 1261 + "ipma" 1262 + "ipp" 1263 + "iqvia" 1264 + "islamic_prayer_times" 1265 + "isy994" 1266 + "izone" 1267 + "jellyfin" 1268 + "jewish_calendar" 1269 + "juicenet" 1270 + "keenetic_ndms2" 1271 + "kira" 1272 + "kmtronic" 1273 + "knx" 1274 + "kodi" 1275 + "konnected" 1276 + "kraken" 1277 + "kulersky" 1278 + "lastfm" 1279 + "lcn" 1280 + "light" 1281 + "litterrobot" 1282 + "local_file" 1283 + "local_ip" 1284 + "locative" 1285 + "lock" 1286 + "logbook" 1287 + "logentries" 1288 + "logger" 1289 + "london_air" 1290 + "lookin" 1291 + "lovelace" 1292 + "luftdaten" 1293 + "lutron_caseta" 1294 + "lyric" 1295 + "mailbox" 1296 + "manual" 1297 + "manual_mqtt" 1298 + "maxcube" 1299 + "mazda" 1300 + "media_player" 1301 + "media_source" 1302 + "melcloud" 1303 + "meraki" 1304 + "met" 1305 + "met_eireann" 1306 + "meteoclimatic" 1307 + "mhz19" 1308 + "microsoft_face" 1309 + "microsoft_face_detect" 1310 + "microsoft_face_identify" 1311 + "mikrotik" 1312 + "mill" 1313 + "min_max" 1314 + "minecraft_server" 1315 + "minio" 1316 + "mobile_app" 1317 + "modbus" 1318 + "modem_callerid" 1319 + "modern_forms" 1320 + "mold_indicator" 1321 + "moon" 1322 + "motion_blinds" 1323 + "motioneye" 1324 + "mqtt" 1325 + "mqtt_eventstream" 1326 + "mqtt_json" 1327 + "mqtt_room" 1328 + "mqtt_statestream" 1329 + "mullvad" 1330 + "mutesync" 1331 + "my" 1332 + "myq" 1333 + "mysensors" 1334 + "mythicbeastsdns" 1335 + "nam" 1336 + "namecheapdns" 1337 + "nanoleaf" 1338 + "neato" 1339 + "ness_alarm" 1340 + "nest" 1341 + "netatmo" 1342 + "network" 1343 + "nexia" 1344 + "nightscout" 1345 + "no_ip" 1346 + "notify" 1347 + "notion" 1348 + "nsw_rural_fire_service_feed" 1349 + "nuki" 1350 + "number" 1351 + "nws" 1352 + "nx584" 1353 + "octoprint" 1354 + "omnilogic" 1355 + "onboarding" 1356 + "ondilo_ico" 1357 + "openalpr_cloud" 1358 + "openalpr_local" 1359 + "openerz" 1360 + "opengarage" 1361 + "openhardwaremonitor" 1362 + "opentherm_gw" 1363 + "openuv" 1364 + "openweathermap" 1365 + "opnsense" 1366 + "ovo_energy" 1367 + "owntracks" 1368 + "ozw" 1369 + "p1_monitor" 1370 + "panel_custom" 1371 + "panel_iframe" 1372 + "persistent_notification" 1373 + "person" 1374 + "philips_js" 1375 + "pi_hole" 1376 + "picnic" 1377 + "ping" 1378 + "plaato" 1379 + "plant" 1380 + "plex" 1381 + "plugwise" 1382 + "point" 1383 + "poolsense" 1384 + "profiler" 1385 + "prometheus" 1386 + "prosegur" 1387 + "proximity" 1388 + "push" 1389 + "pushbullet" 1390 + "pvpc_hourly_pricing" 1391 + "python_script" 1392 + "qld_bushfire" 1393 + "rachio" 1394 + "radarr" 1395 + "rainforest_eagle" 1396 + "rainmachine" 1397 + "random" 1398 + "rdw" 1399 + "recollect_waste" 1400 + "recorder" 1401 + "reddit" 1402 + "remote" 1403 + "renault" 1404 + "rest" 1405 + "rest_command" 1406 + "rflink" 1407 + "rfxtrx" 1408 + "ridwell" 1409 + "ring" 1410 + "risco" 1411 + "rituals_perfume_genie" 1412 + "rmvtransport" 1413 + "roku" 1414 + "roomba" 1415 + "roon" 1416 + "rpi_power" 1417 + "rss_feed_template" 1418 + "ruckus_unleashed" 1419 + "safe_mode" 1420 + "samsungtv" 1421 + "scene" 1422 + "screenlogic" 1423 + "script" 1424 + "search" 1425 + "season" 1426 + "select" 1427 + "sense" 1428 + "sensor" 1429 + "sentry" 1430 + "seventeentrack" 1431 + "sharkiq" 1432 + "shell_command" 1433 + "shelly" 1434 + "shopping_list" 1435 + "sia" 1436 + "sigfox" 1437 + "sighthound" 1438 + "simplisafe" 1439 + "simulated" 1440 + "siren" 1441 + "slack" 1442 + "sleepiq" 1443 + "sma" 1444 + "smappee" 1445 + "smart_meter_texas" 1446 + "smarthab" 1447 + "smartthings" 1448 + "smarttub" 1449 + "smhi" 1450 + "smtp" 1451 + "snips" 1452 + "solaredge" 1453 + "solarlog" 1454 + "soma" 1455 + "somfy" 1456 + "somfy_mylink" 1457 + "sonarr" 1458 + "songpal" 1459 + "sonos" 1460 + "soundtouch" 1461 + "spaceapi" 1462 + "spc" 1463 + "speedtestdotnet" 1464 + "spider" 1465 + "spotify" 1466 + "sql" 1467 + "squeezebox" 1468 + "srp_energy" 1469 + "ssdp" 1470 + "starline" 1471 + "startca" 1472 + "statistics" 1473 + "statsd" 1474 + "stream" 1475 + "stt" 1476 + "subaru" 1477 + "sun" 1478 + "surepetcare" 1479 + "switch" 1480 + "switchbot" 1481 + "switcher_kis" 1482 + "syncthing" 1483 + "syncthru" 1484 + "synology_dsm" 1485 + "system_bridge" 1486 + "system_health" 1487 + "system_log" 1488 + "tado" 1489 + "tag" 1490 + "tailscale" 1491 + "tasmota" 1492 + "tcp" 1493 + "telegram" 1494 + "tellduslive" 1495 + "template" 1496 + "tesla_wall_connector" 1497 + "threshold" 1498 + "tibber" 1499 + "tile" 1500 + "time_date" 1501 + "timer" 1502 + "tod" 1503 + "tolo" 1504 + "tomato" 1505 + "toon" 1506 + "totalconnect" 1507 + "tplink" 1508 + "traccar" 1509 + "trace" 1510 + "tractive" 1511 + "tradfri" 1512 + "trafikverket_weatherstation" 1513 + "transmission" 1514 + "transport_nsw" 1515 + "trend" 1516 + "tts" 1517 + "tuya" 1518 + "twentemilieu" 1519 + "twilio" 1520 + "twinkly" 1521 + "twitch" 1522 + "uk_transport" 1523 + "unifi" 1524 + "unifi_direct" 1525 + "universal" 1526 + "upb" 1527 + "upcloud" 1528 + "updater" 1529 + "upnp" 1530 + "uptime" 1531 + "uptimerobot" 1532 + "usb" 1533 + "usgs_earthquakes_feed" 1534 + "utility_meter" 1535 + "uvc" 1536 + "vacuum" 1537 + "velbus" 1538 + "venstar" 1539 + "vera" 1540 + "verisure" 1541 + "version" 1542 + "vesync" 1543 + "vicare" 1544 + "vilfo" 1545 + "vizio" 1546 + "vlc_telnet" 1547 + "voicerss" 1548 + "volumio" 1549 + "vultr" 1550 + "wake_on_lan" 1551 + "wallbox" 1552 + "water_heater" 1553 + "watttime" 1554 + "waze_travel_time" 1555 + "weather" 1556 + "webhook" 1557 + "webostv" 1558 + "websocket_api" 1559 + "wemo" 1560 + "whirlpool" 1561 + "wiffi" 1562 + "wilight" 1563 + "wled" 1564 + "workday" 1565 + "worldclock" 1566 + "wsdot" 1567 + "xbox" 1568 + "xiaomi" 1569 + "xiaomi_aqara" 1570 + "xiaomi_miio" 1571 + "yale_smart_alarm" 1572 + "yamaha" 1573 + "yamaha_musiccast" 1574 + "yandex_transport" 1575 + "yandextts" 1576 + "yeelight" 1577 + "youless" 1578 + "zeroconf" 1579 + "zerproc" 1580 + "zha" 1581 + "zodiac" 1582 + "zone" 1583 + "zwave" 1584 + "zwave_js" 1585 + ]; 1586 }
+25 -729
pkgs/servers/home-assistant/default.nix
··· 1 { stdenv 2 , lib 3 , fetchFromGitHub 4 , fetchpatch 5 , python3 ··· 41 (mkOverride "python-slugify" "4.0.1" "69a517766e00c1268e5bbfc0d010a0a8508de0b18d30ad5a1ff357f8ae724270") 42 43 (self: super: { 44 - httpcore = super.httpcore.overridePythonAttrs (oldAttrs: rec { 45 - version = "0.14.3"; 46 - src = fetchFromGitHub { 47 - owner = "encode"; 48 - repo = "httpcore"; 49 - rev = version; 50 - sha256 = "sha256-jPsbMhY1lWKBXlh6hsX6DGKXi/g7VQSU00tF6H7qkOo="; 51 - }; 52 - propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ python3.pkgs.certifi ]; 53 - doCheck = false; 54 - }); 55 - }) 56 - 57 - (self: super: { 58 - httpx = super.httpx.overridePythonAttrs (oldAttrs: rec { 59 - version = "0.21.1"; 60 - src = fetchFromGitHub { 61 - owner = "encode"; 62 - repo = "httpx"; 63 - rev = version; 64 - sha256 = "sha256-ayhLP+1hPWAx2ds227CKp5cebVkD5B2Z59L+3dzdINc="; 65 - }; 66 - doCheck = false; 67 - }); 68 - }) 69 - 70 - (self: super: { 71 - pytest-httpx = super.pytest-httpx.overridePythonAttrs (oldAttrs: rec { 72 - version = "0.15.0"; 73 - src = fetchFromGitHub { 74 - owner = "Colin-bin"; 75 - repo = "pytest_httpx"; 76 - rev = "v${version}"; 77 - sha256 = "08dxvjkxlnam3r0yp17495d1vksyawzzkpykacjql1gi6hqlfrwg"; 78 - }; 79 - }); 80 - }) 81 - 82 - (self: super: { 83 - respx = super.respx.overridePythonAttrs (oldAttrs: rec { 84 - version = "0.19.0"; 85 - src = fetchFromGitHub { 86 - owner = "lundberg"; 87 - repo = "respx"; 88 - rev = version; 89 - sha256 = "sha256-xiAt42kc1+rro99KMwzYKi3XC+wxYVqOY11tM+M/uV8="; 90 - }; 91 - }); 92 - }) 93 - 94 - (self: super: { 95 - envoy-reader = super.envoy-reader.overridePythonAttrs (oldAttrs: rec { 96 - patches = [ 97 - # Support for later httpx, https://github.com/jesserizzo/envoy_reader/pull/82 98 - (fetchpatch { 99 - name = "support-later-httpx.patch"; 100 - url = "https://github.com/jesserizzo/envoy_reader/commit/6019a89419fe9c830ba839be7d39ec54725268b0.patch"; 101 - sha256 = "17vsrx13rskvh8swvjisb2dk6x1jdbjcm8ikkpidia35pa24h272"; 102 - }) 103 - ]; 104 - }); 105 - }) 106 - 107 - (self: super: { 108 - sanic = super.sanic.overridePythonAttrs (oldAttrs: rec { 109 - version = "21.9.3"; 110 - src = fetchFromGitHub { 111 - owner = "sanic-org"; 112 - repo = "sanic"; 113 - rev = "v${version}"; 114 - sha256 = "0m18jdw1mvf7jhpnrxhm96p24pxvv0h9m71a8c7sqqkwnnpa3p5i"; 115 - }; 116 - disabledTests = oldAttrs.disabledTests ++ [ 117 - "test_redirect" 118 - "test_chained_redirect" 119 - "test_unix_connection" 120 - ]; 121 - }); 122 - }) 123 - 124 - (self: super: { 125 huawei-lte-api = super.huawei-lte-api.overridePythonAttrs (oldAttrs: rec { 126 version = "1.4.18"; 127 src = fetchFromGitHub { ··· 222 }); 223 }) 224 225 - # Remove as soon the dependency is updated and pytest-httpx > 0.15 226 - (self: super: { 227 - luftdaten = super.luftdaten.overridePythonAttrs (oldAttrs: rec { 228 - version = "0.7.1"; 229 - src = fetchFromGitHub { 230 - owner = "home-assistant-ecosystem"; 231 - repo = "python-luftdaten"; 232 - rev = version; 233 - sha256 = "sha256-76Y5TJet0WtzYXuK8Og0rmpsUIlXK7b37oesh+MliU8="; 234 - }; 235 - }); 236 - }) 237 - 238 - # Remove as soon the dependency is updated and pytest-httpx > 0.15 239 - (self: super: { 240 - pyrmvtransport = super.pyrmvtransport.overridePythonAttrs (oldAttrs: rec { 241 - version = "0.3.3"; 242 - src = fetchFromGitHub { 243 - owner = "cgtobi"; 244 - repo = "pyrmvtransport"; 245 - rev = "v${version}"; 246 - sha256 = "sha256-nFxGEyO+wyRzPayjjv8WNIJ+XIWbVn0dyyjQKHiyr40="; 247 - }; 248 - doCheck = false; 249 - }); 250 - }) 251 - 252 # home-assistant-frontend does not exist in python3.pkgs 253 (self: super: { 254 home-assistant-frontend = self.callPackage ./frontend.nix { }; ··· 265 }); 266 }; 267 268 - py = python3.override { 269 # Put packageOverrides at the start so they are applied after defaultOverrides 270 packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([ packageOverrides ] ++ defaultOverrides); 271 }; ··· 274 275 availableComponents = builtins.attrNames componentPackages.components; 276 277 - getPackages = component: builtins.getAttr component componentPackages.components; 278 279 - componentBuildInputs = lib.concatMap (component: getPackages component py.pkgs) extraComponents; 280 281 # Ensure that we are using a consistent package set 282 - extraBuildInputs = extraPackages py.pkgs; 283 284 # Don't forget to run parse-requirements.py after updating 285 hassVersion = "2021.12.9"; 286 287 - in with py.pkgs; buildPythonApplication rec { 288 pname = "homeassistant"; 289 version = assert (componentPackages.version == hassVersion); hassVersion; 290 291 # check REQUIRED_PYTHON_VER in homeassistant/const.py 292 - disabled = pythonOlder "3.8"; 293 294 # don't try and fail to strip 6600+ python files, it takes minutes! 295 dontStrip = true; ··· 325 substituteInPlace tests/test_config.py --replace '"/usr"' '"/build/media"' 326 ''; 327 328 - propagatedBuildInputs = [ 329 # Only packages required in setup.py 330 aiohttp 331 astral ··· 361 # upstream only tests on Linux, so do we. 362 doCheck = stdenv.isLinux; 363 364 - checkInputs = [ 365 # test infrastructure (selectively from requirement_test.txt) 366 freezegun 367 pytest-aiohttp 368 pytest-freezegun 369 pytest-mock ··· 372 pytest-xdist 373 pytestCheckHook 374 requests-mock 375 stdlib-list 376 - jsonpickle 377 - respx 378 # required by tests/auth/mfa_modules 379 pyotp 380 - ] ++ lib.concatMap (component: getPackages component py.pkgs) componentTests; 381 - 382 - # We can reasonably test components that don't communicate with any network 383 - # services. Before adding new components to this list make sure we have all 384 - # its dependencies packaged and listed in ./component-packages.nix. 385 - componentTests = [ 386 - "abode" 387 - "accuweather" 388 - "acmeda" 389 - "adguard" 390 - "advantage_air" 391 - "aemet" 392 - "agent_dvr" 393 - "air_quality" 394 - "airly" 395 - "airnow" 396 - "airthings" 397 - "airvisual" 398 - "alarm_control_panel" 399 - "alarmdecoder" 400 - "alert" 401 - "alexa" 402 - "almond" 403 - "ambiclimate" 404 - "ambient_station" 405 - "analytics" 406 - "androidtv" 407 - "apache_kafka" 408 - "api" 409 - "apple_tv" 410 - "apprise" 411 - "aprs" 412 - "arcam_fmj" 413 - "arlo" 414 - "asuswrt" 415 - "atag" 416 - "august" 417 - "aurora" 418 - "auth" 419 - "automation" 420 - "awair" 421 - "aws" 422 - "axis" 423 - "azure_devops" 424 - "azure_event_hub" 425 - "bayesian" 426 - "binary_sensor" 427 - "blackbird" 428 - "blebox" 429 - "blink" 430 - "blueprint" 431 - "bluetooth_le_tracker" 432 - "bmw_connected_drive" 433 - "bond" 434 - "bosch_shc" 435 - "braviatv" 436 - "broadlink" 437 - "brother" 438 - "bsblan" 439 - "buienradar" 440 - "caldav" 441 - "calendar" 442 - "camera" 443 - "canary" 444 - "cast" 445 - "cert_expiry" 446 - "climacell" 447 - "climate" 448 - "cloud" 449 - "cloudflare" 450 - "color_extractor" 451 - "comfoconnect" 452 - "command_line" 453 - "compensation" 454 - "config" 455 - "configurator" 456 - "control4" 457 - "conversation" 458 - "coolmaster" 459 - "coronavirus" 460 - "counter" 461 - "cover" 462 - "daikin" 463 - "darksky" 464 - "datadog" 465 - "deconz" 466 "default_config" 467 - "demo" 468 - "denonavr" 469 - "derivative" 470 - "device_automation" 471 - "device_sun_light_trigger" 472 - "device_tracker" 473 - "devolo_home_control" 474 - "dexcom" 475 - "dhcp" 476 - "dialogflow" 477 - "directv" 478 - "discovery" 479 - "doorbird" 480 - "dsmr" 481 - "dte_energy_bridge" 482 - "duckdns" 483 - "dunehd" 484 - "eafm" 485 - "ecobee" 486 - "econet" 487 - "efergy" 488 - "elgato" 489 - "elkm1" 490 - "emonitor" 491 - "emulated_hue" 492 - "emulated_kasa" 493 - "emulated_roku" 494 - "enocean" 495 - "enphase_envoy" 496 - "epson" 497 - "esphome" 498 - "everlights" 499 - "ezviz" 500 - "faa_delays" 501 - "facebook" 502 - "facebox" 503 - "fail2ban" 504 - "fan" 505 - "feedreader" 506 - "ffmpeg" 507 - "fido" 508 - "file" 509 - "filesize" 510 - "filter" 511 - "fireservicerota" 512 - "firmata" 513 - "fjaraskupan" 514 - "flick_electric" 515 - "flipr" 516 - "flo" 517 - "flume" 518 - "flunearyou" 519 - "flux" 520 - "folder" 521 - "folder_watcher" 522 - "foobot" 523 - "foscam" 524 - "freebox" 525 - "freedns" 526 - "fritz" 527 - "fritzbox" 528 - "fritzbox_callmonitor" 529 - "frontend" 530 - "garages_amsterdam" 531 - "gdacs" 532 - "generic" 533 - "generic_thermostat" 534 - "geo_json_events" 535 - "geo_location" 536 - "geo_rss_events" 537 - "geofency" 538 - "geonetnz_quakes" 539 - "geonetnz_volcano" 540 - "gios" 541 - # updated to incompatible version and overriding is annoying because of async_timeout<4 pin 542 - # "glances" 543 - "goalzero" 544 - "gogogate2" 545 - "google" 546 - "google_assistant" 547 - "google_domains" 548 - "google_pubsub" 549 - "google_translate" 550 - "google_travel_time" 551 - "google_wifi" 552 - "gpslogger" 553 - "graphite" 554 - "gree" 555 - "group" 556 - "growatt_server" 557 - "guardian" 558 - "habitica" 559 - "hangouts" 560 - "harmony" 561 - "hassio" 562 - "hddtemp" 563 - "heos" 564 - "here_travel_time" 565 - "hisense_aehw4a1" 566 - "history" 567 - "history_stats" 568 - "hive" 569 - "hlk_sw16" 570 - "home_connect" 571 - "home_plus_control" 572 - "homeassistant" 573 - # disable homekit tests because they fail in the network component 574 - #"homekit" 575 - "homekit_controller" 576 - "homematic" 577 - "homematicip_cloud" 578 - "honeywell" 579 - "html5" 580 - "http" 581 - "huawei_lte" 582 "hue" 583 - "huisbaasje" 584 - "humidifier" 585 - "hunterdouglas_powerview" 586 - "hvv_departures" 587 - "hyperion" 588 - "ialarm" 589 - "iaqualink" 590 - "icloud" 591 - "ifttt" 592 - "ign_sismologia" 593 - "image" 594 - "image_processing" 595 - "imap_email_content" 596 - "influxdb" 597 - "input_boolean" 598 - "input_datetime" 599 - "input_number" 600 - "input_select" 601 - "input_text" 602 - "insteon" 603 - "integration" 604 - "intent" 605 - "intent_script" 606 - "ios" 607 - "ipma" 608 - "ipp" 609 - "iqvia" 610 - "islamic_prayer_times" 611 - "isy994" 612 - "izone" 613 - "jewish_calendar" 614 - "juicenet" 615 - "keenetic_ndms2" 616 - "kira" 617 - "kmtronic" 618 - "knx" 619 - "kodi" 620 - "konnected" 621 - "kraken" 622 - "kulersky" 623 - "lastfm" 624 - "lcn" 625 - "light" 626 - "litterrobot" 627 - "local_file" 628 - "local_ip" 629 - "locative" 630 - "lock" 631 - "logbook" 632 - "logentries" 633 - "logger" 634 - "london_air" 635 - "lovelace" 636 - "luftdaten" 637 - "lutron_caseta" 638 - "lyric" 639 - "mailbox" 640 - "manual" 641 - "manual_mqtt" 642 - "maxcube" 643 - "mazda" 644 - "media_player" 645 - "media_source" 646 - "melcloud" 647 - "meraki" 648 - "met" 649 - "met_eireann" 650 - "meteoclimatic" 651 - "mhz19" 652 - "microsoft_face" 653 - "microsoft_face_detect" 654 - "microsoft_face_identify" 655 - "mikrotik" 656 - "mill" 657 - "min_max" 658 - "minecraft_server" 659 - "minio" 660 - "mobile_app" 661 - "modbus" 662 - "mold_indicator" 663 - "moon" 664 - "motion_blinds" 665 - "motioneye" 666 - "mqtt" 667 - "mqtt_eventstream" 668 - "mqtt_json" 669 - "mqtt_room" 670 - "mqtt_statestream" 671 - "mullvad" 672 - "mutesync" 673 - "my" 674 - "myq" 675 - "mysensors" 676 - "mythicbeastsdns" 677 - "nam" 678 - "namecheapdns" 679 - "neato" 680 - "ness_alarm" 681 - # python-nest has an unfree license, this prevents builds through ofborg 682 - # "nest" 683 - "netatmo" 684 - "nexia" 685 - "nightscout" 686 - "no_ip" 687 - "notify" 688 - "notion" 689 - "nsw_rural_fire_service_feed" 690 - "nuki" 691 - "number" 692 - "nws" 693 - "nx584" 694 - "octoprint" 695 - "omnilogic" 696 - "onboarding" 697 - "ondilo_ico" 698 - "openalpr_cloud" 699 - "openalpr_local" 700 - "openerz" 701 - "openhardwaremonitor" 702 - "opentherm_gw" 703 - "openuv" 704 - "openweathermap" 705 - "opnsense" 706 - "ovo_energy" 707 - "owntracks" 708 - "ozw" 709 - "p1_monitor" 710 - "panel_custom" 711 - "panel_iframe" 712 - "persistent_notification" 713 - "person" 714 - "philips_js" 715 - "pi_hole" 716 - "picnic" 717 - "ping" 718 - "plaato" 719 - "plant" 720 - "plex" 721 - "plugwise" 722 - "point" 723 - "poolsense" 724 - "profiler" 725 - "prometheus" 726 - "proximity" 727 - "push" 728 - "pushbullet" 729 - "pvpc_hourly_pricing" 730 - "python_script" 731 - "qld_bushfire" 732 - "rachio" 733 - "radarr" 734 - "rainmachine" 735 - "random" 736 - "recollect_waste" 737 - "recorder" 738 - "reddit" 739 - "remote" 740 - "renault" 741 - "rest" 742 - "rest_command" 743 - "rflink" 744 - "rfxtrx" 745 - "ring" 746 - "risco" 747 - "rituals_perfume_genie" 748 - "rmvtransport" 749 - "roku" 750 - "roomba" 751 - "roon" 752 - "rss_feed_template" 753 - "ruckus_unleashed" 754 - "safe_mode" 755 - "samsungtv" 756 - "scene" 757 - "screenlogic" 758 - "script" 759 - "search" 760 - "season" 761 - "sense" 762 - "sensor" 763 - "sentry" 764 - "sharkiq" 765 - "shell_command" 766 - "shelly" 767 - "shopping_list" 768 - "sia" 769 - "sigfox" 770 - "sighthound" 771 - "simplisafe" 772 - "simulated" 773 - "slack" 774 - "sleepiq" 775 - "sma" 776 - "smappee" 777 - "smart_meter_texas" 778 - "smarthab" 779 - "smartthings" 780 - "smarttub" 781 - "smhi" 782 - "smtp" 783 - "snips" 784 - "solaredge" 785 - "soma" 786 - "somfy" 787 - "somfy_mylink" 788 - "sonarr" 789 - "songpal" 790 - # disable sonos components test because they rely on ssdp, which doesn't work in our sandbox 791 - # "sonos" 792 - "soundtouch" 793 - "spaceapi" 794 - "spc" 795 - "speedtestdotnet" 796 - "spider" 797 - "spotify" 798 - "sql" 799 - "squeezebox" 800 - "srp_energy" 801 - "ssdp" 802 - "starline" 803 - "startca" 804 - "statistics" 805 - "statsd" 806 - "stream" 807 - "stt" 808 - "subaru" 809 - "sun" 810 - "surepetcare" 811 - "switch" 812 - "switcher_kis" 813 - "syncthing" 814 - "syncthru" 815 - "synology_dsm" 816 - "system_health" 817 - "system_log" 818 - "tado" 819 - "tag" 820 - "tasmota" 821 - "tcp" 822 - "telegram" 823 - "tellduslive" 824 - "template" 825 - "threshold" 826 - "tibber" 827 - "tile" 828 - "time_date" 829 - "timer" 830 - "tod" 831 - "tomato" 832 - "toon" 833 - "totalconnect" 834 - "tplink" 835 - "traccar" 836 - "trace" 837 - "tradfri" 838 - "transmission" 839 - "transport_nsw" 840 - "trend" 841 - "tts" 842 - "tuya" 843 - "twentemilieu" 844 - "twilio" 845 - "twinkly" 846 - "twitch" 847 - "uk_transport" 848 - "unifi" 849 - "unifi_direct" 850 - "universal" 851 - "upb" 852 - "upcloud" 853 - "updater" 854 - # disabled, because it tries to join a multicast group and fails to find a usable network interface 855 - # "upnp" 856 - "uptime" 857 - "uptimerobot" 858 - "usgs_earthquakes_feed" 859 - "utility_meter" 860 - "uvc" 861 - "vacuum" 862 - "velbus" 863 - # disabled, because it includes onewire component tests, for which we lack p1wire dependency 864 - # "venstar" 865 - "vera" 866 - "verisure" 867 - "version" 868 - "vesync" 869 - "vilfo" 870 - "vizio" 871 - "vlc_telnet" 872 - "voicerss" 873 - "volumio" 874 - "vultr" 875 - "wake_on_lan" 876 - "wallbox" 877 - "water_heater" 878 - "waze_travel_time" 879 - "weather" 880 - "webhook" 881 - "webostv" 882 - "websocket_api" 883 - "wemo" 884 - "wiffi" 885 - "wilight" 886 - "wled" 887 - "workday" 888 - "worldclock" 889 - "wsdot" 890 - "xbox" 891 - "xiaomi" 892 - "xiaomi_aqara" 893 - # disabled, because we require cryptography>=35.0 for the miio package 894 - # "xiaomi_miio" 895 - "yamaha" 896 - "yandex_transport" 897 - "yandextts" 898 - "yeelight" 899 - "youless" 900 - # disabled, because it tries to join a multicast group and fails to find a usable network interface 901 - # "zeroconf" 902 - "zerproc" 903 - "zha" 904 - "zodiac" 905 - "zone" 906 - "zwave" 907 - "zwave_js" 908 - ] ++ lib.optionals (builtins.any (s: s == stdenv.hostPlatform.system) debugpy.meta.platforms) [ 909 - "debugpy" 910 ]; 911 912 pytestFlagsArray = [ ··· 919 "--only-rerun RuntimeError" 920 # enable full variable printing on error 921 "--showlocals" 922 - # here_travel_time/test_sensor.py: Tries to access HERE API: herepy.error.HEREError: Error occured on __get 923 - "--deselect tests/components/here_travel_time/test_sensor.py::test_invalid_credentials" 924 - # screenlogic/test_config_flow.py: Tries to send out UDP broadcasts 925 - "--deselect tests/components/screenlogic/test_config_flow.py::test_form_cannot_connect" 926 - # abode/test_camera.py: Race condition in pickle file creationg 927 - "--deselect tests/components/abode/test_camera.py::test_camera_off" 928 - # asuswrt/test_config_flow.py: Sandbox network limitations, fails with unexpected error 929 - "--deselect tests/components/asuswrt/test_config_flow.py::test_on_connect_failed" 930 - # shelly/test_config_flow.py: Tries to join multicast group 931 - "--deselect tests/components/shelly/test_config_flow.py::test_form" 932 - "--deselect tests/components/shelly/test_config_flow.py::test_title_without_name" 933 - "--deselect tests/components/shelly/test_config_flow.py::test_form_auth" 934 - "--deselect tests/components/shelly/test_config_flow.py::test_form_errors_test_connection" 935 - "--deselect tests/components/shelly/test_config_flow.py::test_user_setup_ignored_device" 936 - "--deselect tests/components/shelly/test_config_flow.py::test_form_auth_errors_test_connection" 937 - "--deselect tests/components/shelly/test_config_flow.py::test_form_auth_errors_test_connection" 938 - "--deselect tests/components/shelly/test_config_flow.py::test_form_auth_errors_test_connection" 939 - "--deselect tests/components/shelly/test_config_flow.py::test_zeroconf" 940 - "--deselect tests/components/shelly/test_config_flow.py::test_zeroconf_sleeping_device" 941 - "--deselect tests/components/shelly/test_config_flow.py::test_zeroconf_sleeping_device_error" 942 - "--deselect tests/components/shelly/test_config_flow.py::test_zeroconf_sleeping_device_error" 943 - "--deselect tests/components/shelly/test_config_flow.py::test_zeroconf_require_auth" 944 - # prometheus/test_init.py: Spurious AssertionError regarding humidifier_target_humidity_percent metric 945 - "--deselect tests/components/prometheus/test_init.py::test_view" 946 - # smhi/test_init.py: Tries to fetch data from the network: socket.gaierror: [Errno -2] Name or service not known 947 - "--deselect tests/components/smhi/test_init.py::test_remove_entry" 948 - # wallbox/test_config_flow.py: Tries to connect to api.wall-box.cim: Failed to establish a new connection: [Errno -2] Name or service not known 949 - "--deselect tests/components/wallbox/test_config_flow.py::test_form_invalid_auth" 950 - "--deselect tests/components/wallbox/test_config_flow.py::test_form_cannot_connect" 951 - # default_config/test_init.py: Tries to check for updates and fails ungracefully without network access 952 - "--deselect tests/components/default_config/test_init.py::test_setup" 953 - # local_ip/test_{init,config_flow}.py: tries to lookup a route towards a multicast address and fails 954 - "--deselect tests/components/local_ip/test_init.py::test_basic_setup" 955 - "--deselect tests/components/local_ip/test_config_flow.py::test_config_flow" 956 - # netatmo/test_select.py: NoneType object has no attribute state 957 - "--deselect tests/components/netatmo/test_select.py::test_select_schedule_thermostats" 958 - # wemo/test_sensor.py: KeyError for various power attributes 959 - "--deselect tests/components/wemo/test_sensor.py::TestInsightTodayEnergy::test_state_unavailable" 960 - "--deselect tests/components/wemo/test_sensor.py::TestInsightCurrentPower::test_state_unavailable" 961 # helpers/test_system_info.py: AssertionError: assert 'Unknown' == 'Home Assistant Container' 962 "--deselect tests/helpers/test_system_info.py::test_container_installationtype" 963 # tests are located in tests/ 964 "tests" 965 - # dynamically add packages required for component tests 966 - ] ++ map (component: "tests/components/" + component) componentTests; 967 968 disabledTestPaths = [ 969 # don't bulk test all components 970 "tests/components" 971 # pyotp since v2.4.0 complains about the short mock keys, hass pins v2.3.0 972 "tests/auth/mfa_modules/test_notify.py" 973 - # emulated_hue/test_upnp.py: Tries to establish the public ipv4 address 974 - "tests/components/emulated_hue/test_upnp.py" 975 - # tado/test_{climate,water_heater}.py: Tries to connect to my.tado.com 976 - "tests/components/tado/test_climate.py" 977 - "tests/components/tado/test_water_heater.py" 978 ]; 979 980 disabledTests = [ 981 # AssertionError: assert 1 == 0 982 - "test_error_posted_as_event" 983 "test_merge" 984 - # ModuleNotFoundError: No module named 'pyqwikswitch' 985 - "test_merge_id_schema" 986 - # keyring.errors.NoKeyringError: No recommended backend was available. 987 - "test_secrets_from_unrelated_fails" 988 - "test_secrets_credstash" 989 - # generic/test_camera.py: AssertionError: 500 == 200 990 - "test_fetching_without_verify_ssl" 991 - "test_fetching_url_with_verify_ssl" 992 - # util/test_package.py: AssertionError on package.is_installed('homeassistant>=999.999.999') 993 - "test_check_package_version_does_not_match" 994 - # homeassistant/util/thread.py:51: SystemError 995 - "test_executor_shutdown_can_interrupt_threads" 996 - # {'theme_color': '#03A9F4'} != {'theme_color': 'blue'} 997 - "test_webhook_handle_get_config" 998 - # onboarding tests rpi_power component, for which we are lacking rpi_bad_power library 999 - "test_onboarding_core_sets_up_rpi_power" 1000 - "test_onboarding_core_no_rpi_power" 1001 - # hue/test_sensor_base.py: Race condition when counting events 1002 - "test_hue_events" 1003 - # august/test_lock.py: AssertionError: assert 'unlocked' == 'locked' / assert 'off' == 'on' 1004 - "test_lock_update_via_pubnub" 1005 - "test_door_sense_update_via_pubnub" 1006 # Tests are flaky 1007 "test_config_platform_valid" 1008 - "test_hls_stream" 1009 ]; 1010 1011 preCheck = '' 1012 export HOME="$TEMPDIR" 1013 1014 - patch -p1 < ${./patches/tests-mock-source-ip.patch} 1015 - 1016 # the tests require the existance of a media dir 1017 mkdir /build/media 1018 1019 # put ping binary into PATH, e.g. for wake_on_lan tests 1020 export PATH=${inetutils}/bin:$PATH 1021 - 1022 - # error out when component test directory is missing, otherwise hidden by xdist execution :( 1023 - for component in ${lib.concatStringsSep " " (map lib.escapeShellArg componentTests)}; do 1024 - test -d "tests/components/$component" || { 1025 - >2& echo "ERROR: Tests for component '$component' were enabled, but they do not exist!" 1026 - exit 1 1027 - } 1028 - done 1029 ''; 1030 1031 passthru = { 1032 - inherit availableComponents extraComponents; 1033 - python = py; 1034 tests = { 1035 - inherit (nixosTests) home-assistant; 1036 }; 1037 }; 1038
··· 1 { stdenv 2 , lib 3 + , callPackage 4 , fetchFromGitHub 5 , fetchpatch 6 , python3 ··· 42 (mkOverride "python-slugify" "4.0.1" "69a517766e00c1268e5bbfc0d010a0a8508de0b18d30ad5a1ff357f8ae724270") 43 44 (self: super: { 45 huawei-lte-api = super.huawei-lte-api.overridePythonAttrs (oldAttrs: rec { 46 version = "1.4.18"; 47 src = fetchFromGitHub { ··· 142 }); 143 }) 144 145 # home-assistant-frontend does not exist in python3.pkgs 146 (self: super: { 147 home-assistant-frontend = self.callPackage ./frontend.nix { }; ··· 158 }); 159 }; 160 161 + python = python3.override { 162 # Put packageOverrides at the start so they are applied after defaultOverrides 163 packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([ packageOverrides ] ++ defaultOverrides); 164 }; ··· 167 168 availableComponents = builtins.attrNames componentPackages.components; 169 170 + inherit (componentPackages) supportedComponentsWithTests; 171 172 + getPackages = component: componentPackages.components.${component}; 173 + 174 + componentBuildInputs = lib.concatMap (component: getPackages component python.pkgs) extraComponents; 175 176 # Ensure that we are using a consistent package set 177 + extraBuildInputs = extraPackages python.pkgs; 178 179 # Don't forget to run parse-requirements.py after updating 180 hassVersion = "2021.12.9"; 181 182 + in python.pkgs.buildPythonApplication rec { 183 pname = "homeassistant"; 184 version = assert (componentPackages.version == hassVersion); hassVersion; 185 186 # check REQUIRED_PYTHON_VER in homeassistant/const.py 187 + disabled = python.pythonOlder "3.8"; 188 189 # don't try and fail to strip 6600+ python files, it takes minutes! 190 dontStrip = true; ··· 220 substituteInPlace tests/test_config.py --replace '"/usr"' '"/build/media"' 221 ''; 222 223 + propagatedBuildInputs = with python.pkgs; [ 224 # Only packages required in setup.py 225 aiohttp 226 astral ··· 256 # upstream only tests on Linux, so do we. 257 doCheck = stdenv.isLinux; 258 259 + checkInputs = with python.pkgs; [ 260 # test infrastructure (selectively from requirement_test.txt) 261 freezegun 262 + jsonpickle 263 pytest-aiohttp 264 pytest-freezegun 265 pytest-mock ··· 268 pytest-xdist 269 pytestCheckHook 270 requests-mock 271 + respx 272 stdlib-list 273 + tqdm 274 # required by tests/auth/mfa_modules 275 pyotp 276 + ] ++ lib.concatMap (component: getPackages component python.pkgs) [ 277 + # some components are needed even if tests in tests/components are disabled 278 "default_config" 279 "hue" 280 ]; 281 282 pytestFlagsArray = [ ··· 289 "--only-rerun RuntimeError" 290 # enable full variable printing on error 291 "--showlocals" 292 # helpers/test_system_info.py: AssertionError: assert 'Unknown' == 'Home Assistant Container' 293 "--deselect tests/helpers/test_system_info.py::test_container_installationtype" 294 # tests are located in tests/ 295 "tests" 296 + ]; 297 298 disabledTestPaths = [ 299 # don't bulk test all components 300 "tests/components" 301 # pyotp since v2.4.0 complains about the short mock keys, hass pins v2.3.0 302 "tests/auth/mfa_modules/test_notify.py" 303 ]; 304 305 disabledTests = [ 306 # AssertionError: assert 1 == 0 307 "test_merge" 308 # Tests are flaky 309 "test_config_platform_valid" 310 ]; 311 312 preCheck = '' 313 export HOME="$TEMPDIR" 314 315 # the tests require the existance of a media dir 316 mkdir /build/media 317 318 # put ping binary into PATH, e.g. for wake_on_lan tests 319 export PATH=${inetutils}/bin:$PATH 320 ''; 321 322 passthru = { 323 + inherit 324 + availableComponents 325 + extraComponents 326 + getPackages 327 + python 328 + supportedComponentsWithTests; 329 tests = { 330 + nixos = nixosTests.home-assistant; 331 + components = callPackage ./tests.nix { }; 332 }; 333 }; 334
+16 -3
pkgs/servers/home-assistant/parse-requirements.py
··· 62 63 def parse_components(version: str = "master"): 64 components = {} 65 with tempfile.TemporaryDirectory() as tmp: 66 with urlopen( 67 f"https://github.com/home-assistant/home-assistant/archive/{version}.tar.gz" ··· 69 tarfile.open(fileobj=BytesIO(response.read())).extractall(tmp) 70 # Use part of a script from the Home Assistant codebase 71 core_path = os.path.join(tmp, f"core-{version}") 72 sys.path.append(core_path) 73 from script.hassfest.model import Integration 74 - 75 integrations = Integration.load_dir( 76 pathlib.Path( 77 os.path.join(core_path, "homeassistant/components") ··· 81 integration = integrations[domain] 82 if not integration.disabled: 83 components[domain] = integration.manifest 84 - return components 85 86 87 # Recursively get the requirements of a component and its dependencies ··· 162 packages = dump_packages() 163 version = get_version() 164 print("Generating component-packages.nix for version {}".format(version)) 165 - components = parse_components(version=version) 166 build_inputs = {} 167 outdated = {} 168 for component in sorted(components.keys()): ··· 205 f.write(f" # missing inputs: {' '.join(missing)}") 206 f.write("\n") 207 f.write(" };\n") 208 f.write("}\n") 209 210 supported_components = reduce(lambda n, c: n + (build_inputs[c][1] == []),
··· 62 63 def parse_components(version: str = "master"): 64 components = {} 65 + components_with_tests = [] 66 with tempfile.TemporaryDirectory() as tmp: 67 with urlopen( 68 f"https://github.com/home-assistant/home-assistant/archive/{version}.tar.gz" ··· 70 tarfile.open(fileobj=BytesIO(response.read())).extractall(tmp) 71 # Use part of a script from the Home Assistant codebase 72 core_path = os.path.join(tmp, f"core-{version}") 73 + 74 + for entry in os.scandir(os.path.join(core_path, "tests/components")): 75 + if entry.is_dir(): 76 + components_with_tests.append(entry.name) 77 + 78 sys.path.append(core_path) 79 from script.hassfest.model import Integration 80 integrations = Integration.load_dir( 81 pathlib.Path( 82 os.path.join(core_path, "homeassistant/components") ··· 86 integration = integrations[domain] 87 if not integration.disabled: 88 components[domain] = integration.manifest 89 + 90 + return components, components_with_tests 91 92 93 # Recursively get the requirements of a component and its dependencies ··· 168 packages = dump_packages() 169 version = get_version() 170 print("Generating component-packages.nix for version {}".format(version)) 171 + components, components_with_tests = parse_components(version=version) 172 build_inputs = {} 173 outdated = {} 174 for component in sorted(components.keys()): ··· 211 f.write(f" # missing inputs: {' '.join(missing)}") 212 f.write("\n") 213 f.write(" };\n") 214 + f.write(" # components listed in tests/components for which all dependencies are packaged\n") 215 + f.write(" supportedComponentsWithTests = [\n") 216 + for component, deps in build_inputs.items(): 217 + available, missing = deps 218 + if len(missing) == 0 and component in components_with_tests: 219 + f.write(f' "{component}"' + "\n") 220 + f.write(" ];\n") 221 f.write("}\n") 222 223 supported_components = reduce(lambda n, c: n + (build_inputs[c][1] == []),
+2 -2
pkgs/servers/home-assistant/patches/tests-mock-source-ip.patch
··· 1 diff --git a/homeassistant/components/network/__init__.py b/homeassistant/components/network/__init__.py 2 - index 7cc864727d..69333a5454 100644 3 --- a/homeassistant/components/network/__init__.py 4 +++ b/homeassistant/components/network/__init__.py 5 - @@ -26,7 +26,7 @@ async def async_get_source_ip( 6 ) -> str: 7 """Get the source ip for a target ip.""" 8 adapters = await async_get_adapters(hass)
··· 1 diff --git a/homeassistant/components/network/__init__.py b/homeassistant/components/network/__init__.py 2 + index b3ef88e7ab..b7a8471e1a 100644 3 --- a/homeassistant/components/network/__init__.py 4 +++ b/homeassistant/components/network/__init__.py 5 + @@ -30,7 +30,7 @@ async def async_get_source_ip( 6 ) -> str: 7 """Get the source ip for a target ip.""" 8 adapters = await async_get_adapters(hass)
+69
pkgs/servers/home-assistant/tests.nix
···
··· 1 + { lib 2 + , home-assistant 3 + }: 4 + 5 + let 6 + # some components' tests have additional dependencies 7 + extraCheckInputs = with home-assistant.python.pkgs; { 8 + alexa = [ ha-av ]; 9 + camera = [ ha-av ]; 10 + cloud = [ mutagen ]; 11 + config = [ pydispatcher ]; 12 + generic = [ ha-av ]; 13 + google_translate = [ mutagen ]; 14 + nest = [ ha-av ]; 15 + onboarding = [ pymetno rpi-bad-power ]; 16 + voicerss = [ mutagen ]; 17 + yandextts = [ mutagen ]; 18 + zha = [ pydeconz ]; 19 + zwave_js = [ homeassistant-pyozw ]; 20 + }; 21 + 22 + extraDisabledTestPaths = { 23 + tado = [ 24 + # tado/test_{climate,water_heater}.py: Tries to connect to my.tado.com 25 + "tests/components/tado/test_climate.py" 26 + "tests/components/tado/test_water_heater.py" 27 + ]; 28 + }; 29 + 30 + extraPytestFlagsArray = { 31 + asuswrt = [ 32 + # asuswrt/test_config_flow.py: Sandbox network limitations, fails with unexpected error 33 + "--deselect tests/components/asuswrt/test_config_flow.py::test_on_connect_failed" 34 + ]; 35 + }; 36 + in lib.listToAttrs (map (component: lib.nameValuePair component ( 37 + home-assistant.overridePythonAttrs (old: { 38 + pname = "homeassistant-test-${component}"; 39 + 40 + dontBuild = true; 41 + dontInstall = true; 42 + 43 + checkInputs = old.checkInputs 44 + ++ home-assistant.getPackages component home-assistant.python.pkgs 45 + ++ extraCheckInputs.${component} or [ ]; 46 + 47 + disabledTestPaths = old.disabledTestPaths ++ extraDisabledTestPaths.${component} or [ ]; 48 + 49 + pytestFlagsArray = lib.remove "tests" old.pytestFlagsArray 50 + ++ extraPytestFlagsArray.${component} or [ ] 51 + ++ [ "tests/components/${component}" ]; 52 + 53 + preCheck = old.preCheck + lib.optionalString (component != "network") '' 54 + patch -p1 < ${./patches/tests-mock-source-ip.patch} 55 + ''; 56 + 57 + meta = old.meta // { 58 + broken = lib.elem component [ 59 + "airtouch4" 60 + "glances" 61 + "ridwell" 62 + "venstar" 63 + "yamaha_musiccast" 64 + ]; 65 + # upstream only tests on Linux, so do we. 66 + platforms = lib.platforms.linux; 67 + }; 68 + }) 69 + )) home-assistant.supportedComponentsWithTests)
+2
pkgs/top-level/all-packages.nix
··· 21066 21067 home-assistant-cli = callPackage ../servers/home-assistant/cli.nix { }; 21068 21069 hqplayerd = callPackage ../servers/hqplayerd { }; 21070 21071 https-dns-proxy = callPackage ../servers/dns/https-dns-proxy { };
··· 21066 21067 home-assistant-cli = callPackage ../servers/home-assistant/cli.nix { }; 21068 21069 + home-assistant-component-tests = recurseIntoAttrs home-assistant.tests.components; 21070 + 21071 hqplayerd = callPackage ../servers/hqplayerd { }; 21072 21073 https-dns-proxy = callPackage ../servers/dns/https-dns-proxy { };
+2
pkgs/top-level/python-packages.nix
··· 8639 8640 rpdb = callPackage ../development/python-modules/rpdb { }; 8641 8642 rply = callPackage ../development/python-modules/rply { }; 8643 8644 rpm = toPythonModule (pkgs.rpm.override {
··· 8639 8640 rpdb = callPackage ../development/python-modules/rpdb { }; 8641 8642 + rpi-bad-power = callPackage ../development/python-modules/rpi-bad-power { }; 8643 + 8644 rply = callPackage ../development/python-modules/rply { }; 8645 8646 rpm = toPythonModule (pkgs.rpm.override {