Merge pull request #123456 from mweinelt/home-assistant-tests

This commit is contained in:
Martin Weinelt 2021-05-19 18:33:56 +02:00 committed by GitHub
commit eaf59b9de3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 267 additions and 18 deletions

View File

@ -12,14 +12,14 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "pyflume"; pname = "pyflume";
version = "0.6.4"; version = "0.7.0";
disabled = pythonOlder "3.7"; disabled = pythonOlder "3.7";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ChrisMandich"; owner = "ChrisMandich";
repo = "PyFlume"; repo = "PyFlume";
rev = "v${version}"; rev = "v${version}";
sha256 = "1dm560hh6fl1waiwsq8m31apmvvwhc3y95bfdb7449bs8k96dmxq"; sha256 = "129sz33a270v120bzl9l98nmvdzn7ns4cf9w2v18lmzlldbyz2vn";
}; };
prePatch = '' prePatch = ''

View File

@ -89,7 +89,7 @@
"bloomsky" = ps: with ps; [ ]; "bloomsky" = ps: with ps; [ ];
"blueprint" = ps: with ps; [ ]; "blueprint" = ps: with ps; [ ];
"bluesound" = ps: with ps; [ xmltodict ]; "bluesound" = ps: with ps; [ xmltodict ];
"bluetooth_le_tracker" = ps: with ps; [ ]; # missing inputs: pygatt[GATTTOOL] "bluetooth_le_tracker" = ps: with ps; [ pygatt ];
"bluetooth_tracker" = ps: with ps; [ bt_proximity pybluez ]; "bluetooth_tracker" = ps: with ps; [ bt_proximity pybluez ];
"bme280" = ps: with ps; [ smbus-cffi ]; # missing inputs: i2csense "bme280" = ps: with ps; [ smbus-cffi ]; # missing inputs: i2csense
"bme680" = ps: with ps; [ bme680 smbus-cffi ]; "bme680" = ps: with ps; [ bme680 smbus-cffi ];
@ -755,7 +755,7 @@
"sinch" = ps: with ps; [ ]; # missing inputs: clx-sdk-xms "sinch" = ps: with ps; [ ]; # missing inputs: clx-sdk-xms
"sisyphus" = ps: with ps; [ ]; # missing inputs: sisyphus-control "sisyphus" = ps: with ps; [ ]; # missing inputs: sisyphus-control
"sky_hub" = ps: with ps; [ ]; # missing inputs: pyskyqhub "sky_hub" = ps: with ps; [ ]; # missing inputs: pyskyqhub
"skybeacon" = ps: with ps; [ ]; # missing inputs: pygatt[GATTTOOL] "skybeacon" = ps: with ps; [ pygatt ];
"skybell" = ps: with ps; [ skybellpy ]; "skybell" = ps: with ps; [ skybellpy ];
"slack" = ps: with ps; [ slackclient ]; "slack" = ps: with ps; [ slackclient ];
"sleepiq" = ps: with ps; [ sleepyq ]; "sleepiq" = ps: with ps; [ sleepyq ];

View File

@ -2,6 +2,7 @@
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, python3 , python3
, inetutils
, nixosTests , nixosTests
# Look up dependencies of specified components in component-packages.nix # Look up dependencies of specified components in component-packages.nix
@ -55,6 +56,46 @@ let
(mkOverride "ring-doorbell" "0.6.2" (mkOverride "ring-doorbell" "0.6.2"
"fbd537722a27b3b854c26506d894b7399bb8dc57ff36083285971227a2d46560") "fbd537722a27b3b854c26506d894b7399bb8dc57ff36083285971227a2d46560")
# Pinned due to API changes in pyflunearyou>=2.0
(self: super: {
pyflunearyou = super.pyflunearyou.overridePythonAttrs (oldAttrs: rec {
version = "1.0.7";
src = fetchFromGitHub {
owner = "bachya";
repo = "pyflunearyou";
rev = version;
sha256 = "0hq55k298m9a90qb3lasw9bi093hzndrah00rfq94bp53aq0is99";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace "poetry.masonry.api" "poetry.core.masonry.api" \
--replace 'msgpack = "^0.6.2"' 'msgpack = "*"' \
--replace 'ujson = "^1.35"' 'ujson = "*"'
'';
});
})
# Pinned due to API changes in pylast 4.2.1
(mkOverride "pylast" "4.2.0"
"0zd0dn2l738ndz62vpa751z0ldnm91dcz9zzbvxv53r08l0s9yf3")
# Pinned due to API changes in pyopenuv>=1.1.0
(self: super: {
pyopenuv = super.pyopenuv.overridePythonAttrs (oldAttrs: rec {
version = "1.0.13";
src = fetchFromGitHub {
owner = "bachya";
repo = "pyopenuv";
rev = version;
sha256 = "1gx9xjkyvqqy8410lnbshq1j5y4cb0cdc4m505g17rwdzdwb01y8";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace "poetry.masonry.api" "poetry.core.masonry.api"
'';
});
})
# Pinned due to API changes in pyruckus>0.12 # Pinned due to API changes in pyruckus>0.12
(self: super: { (self: super: {
pyruckus = super.pyruckus.overridePythonAttrs (oldAttrs: rec { pyruckus = super.pyruckus.overridePythonAttrs (oldAttrs: rec {
@ -199,33 +240,69 @@ in with py.pkgs; buildPythonApplication rec {
# services. Before adding new components to this list make sure we have all # services. Before adding new components to this list make sure we have all
# its dependencies packaged and listed in ./component-packages.nix. # its dependencies packaged and listed in ./component-packages.nix.
componentTests = [ componentTests = [
"abode"
"accuweather" "accuweather"
"acmeda"
"adguard"
"advantage_air"
"agent_dvr"
"air_quality"
"airly" "airly"
"airnow"
"airvisual"
"alarm_control_panel"
"alarmdecoder"
"alert"
"alexa"
"almond"
"ambiclimate"
"ambient_station"
"analytics" "analytics"
"androidtv" "androidtv"
"alert" "apache_kafka"
"api" "api"
"apple_tv"
"apprise"
"arlo"
"asuswrt"
"august"
"aurora"
"auth" "auth"
"automation" "automation"
"awair"
"aws"
"axis" "axis"
"bayesian" "bayesian"
"binary_sensor" "binary_sensor"
"blackbird"
"blueprint"
"bluetooth_le_tracker"
"braviatv"
"broadlink"
"brother" "brother"
"bsblan"
"caldav" "caldav"
"calendar" "calendar"
"camera" "camera"
"canary" "canary"
"cast" "cast"
"cert_expiry"
"climacell" "climacell"
"climate" "climate"
"cloud" "cloud"
"cloudflare"
"comfoconnect" "comfoconnect"
"command_line" "command_line"
"compensation"
"config" "config"
"configurator" "configurator"
"conversation" "conversation"
"coronavirus"
"counter" "counter"
"cover" "cover"
"daikin"
"darksky"
"datadog"
"deconz" "deconz"
"default_config" "default_config"
"demo" "demo"
@ -235,22 +312,42 @@ in with py.pkgs; buildPythonApplication rec {
"device_sun_light_trigger" "device_sun_light_trigger"
"device_tracker" "device_tracker"
"devolo_home_control" "devolo_home_control"
"dexcom"
"dhcp" "dhcp"
"dialogflow"
"discovery" "discovery"
"dsmr" "dsmr"
"dte_energy_bridge"
"duckdns"
"dyson"
"eafm"
"econet" "econet"
"efergy"
"emonitor"
"emulated_hue" "emulated_hue"
"esphome" "esphome"
"fan" "everlights"
"ezviz"
"faa_delays" "faa_delays"
"facebook"
"facebox"
"fail2ban"
"fan"
"feedreader"
"ffmpeg" "ffmpeg"
"fido"
"file" "file"
"filesize" "filesize"
"filter" "filter"
"firmata"
"flo"
"flume"
"flunearyou"
"flux" "flux"
"folder" "folder"
"folder_watcher" "folder_watcher"
"freebox" "freebox"
"freedns"
"fritz" "fritz"
"fritzbox" "fritzbox"
"fritzbox_callmonitor" "fritzbox_callmonitor"
@ -259,59 +356,97 @@ in with py.pkgs; buildPythonApplication rec {
"generic_thermostat" "generic_thermostat"
"geo_json_events" "geo_json_events"
"geo_location" "geo_location"
"geofency"
"glances"
"google"
"google_assistant"
"google_domains"
"google_pubsub"
"google_translate"
"google_travel_time"
"google_wifi"
"gpslogger"
"graphite"
"group" "group"
"guardian"
"harmony"
"hassio"
"hddtemp" "hddtemp"
"history" "history"
"history_stats" "history_stats"
"home_connect" "home_connect"
"home_plus_control" "home_plus_control"
"homeassistant"
"homekit" "homekit"
"homekit_controller" "homekit_controller"
"homeassistant"
"homematic" "homematic"
"homematicip_cloud" "homematicip_cloud"
"html5" "html5"
"http" "http"
"hue" "hue"
"humidifier"
"hyperion" "hyperion"
"ialarm"
"iaqualink" "iaqualink"
"icloud"
"ifttt" "ifttt"
"image" "image"
"image_processing" "image_processing"
"imap_email_content"
"influxdb" "influxdb"
"input_boolean" "input_boolean"
"input_datetime" "input_datetime"
"input_text"
"input_number" "input_number"
"input_select" "input_select"
"input_text"
"insteon"
"integration"
"intent" "intent"
"intent_script" "intent_script"
"ios"
"ipp" "ipp"
"iqvia"
"islamic_prayer_times" "islamic_prayer_times"
"jewish_calendar" "jewish_calendar"
"kira"
"kmtronic" "kmtronic"
"knx" "knx"
"kodi" "kodi"
"lastfm"
"lcn"
"light" "light"
"litterrobot" "litterrobot"
"local_file" "local_file"
"local_ip" "local_ip"
"locative"
"lock" "lock"
"logbook" "logbook"
"logentries" "logentries"
"logger" "logger"
"london_air"
"lovelace" "lovelace"
"luftdaten"
"lutron_caseta" "lutron_caseta"
"lyric"
"mailbox"
"manual" "manual"
"manual_mqtt" "manual_mqtt"
"mazda" "mazda"
"media_player" "media_player"
"media_source" "media_source"
"meraki"
"met" "met"
"met_eireann" "met_eireann"
"microsoft_face"
"microsoft_face_detect"
"microsoft_face_identify"
"mikrotik"
"min_max"
"minecraft_server" "minecraft_server"
"minio"
"mobile_app" "mobile_app"
"modbus" "modbus"
"mold_indicator"
"moon" "moon"
"motioneye" "motioneye"
"mqtt" "mqtt"
@ -321,33 +456,66 @@ in with py.pkgs; buildPythonApplication rec {
"mqtt_statestream" "mqtt_statestream"
"mullvad" "mullvad"
"mutesync" "mutesync"
"my"
"myq"
"mysensors"
"namecheapdns"
"neato"
"netatmo"
"nexia" "nexia"
"no_ip"
"notify" "notify"
"notion" "notion"
"nuki"
"number" "number"
"nws"
"nx584" "nx584"
"omnilogic" "omnilogic"
"onboarding"
"ondilo_ico" "ondilo_ico"
"openalpr_cloud"
"openalpr_local"
"openerz" "openerz"
"openhardwaremonitor"
"opentherm_gw" "opentherm_gw"
"openuv"
"openweathermap"
"opnsense"
"ovo_energy" "ovo_energy"
"owntracks"
"ozw" "ozw"
"panel_custom" "panel_custom"
"panel_iframe" "panel_iframe"
"persistent_notification" "persistent_notification"
"person" "person"
"philips_js" "philips_js"
"pi_hole"
"picnic"
"ping"
"plaato" "plaato"
"plant"
"plex"
"plugwise" "plugwise"
"poolsense"
"profiler"
"prometheus" "prometheus"
"proximity" "proximity"
"push" "push"
"pushbullet"
"pvpc_hourly_pricing" "pvpc_hourly_pricing"
"python_script" "python_script"
"rachio"
"radarr"
"rainmachine"
"random" "random"
"recollect_waste"
"recorder" "recorder"
"reddit"
"remote"
"rest" "rest"
"rest_command" "rest_command"
"ring"
"risco"
"rituals_perfume_genie" "rituals_perfume_genie"
"rmvtransport" "rmvtransport"
"roku" "roku"
@ -355,66 +523,125 @@ in with py.pkgs; buildPythonApplication rec {
"rss_feed_template" "rss_feed_template"
"ruckus_unleashed" "ruckus_unleashed"
"safe_mode" "safe_mode"
"samsungtv"
"scene" "scene"
"screenlogic" "screenlogic"
"script" "script"
"search" "search"
"season"
"sensor"
"sentry"
"sharkiq"
"shell_command" "shell_command"
"shelly"
"shopping_list" "shopping_list"
"sigfox"
"sighthound"
"simplisafe" "simplisafe"
"simulated" "simulated"
"slack"
"sleepiq" "sleepiq"
"sma" "sma"
"smhi" "smappee"
"sensor"
"slack"
"smartthings" "smartthings"
"smarttub" "smarttub"
"smhi"
"smtp" "smtp"
"smappee" "snips"
"solaredge" "solaredge"
"soma"
"somfy"
"sonos" "sonos"
"soundtouch"
"spaceapi"
"speedtestdotnet"
"spotify" "spotify"
"sql" "sql"
"squeezebox"
"ssdp" "ssdp"
"startca"
"statistics"
"statsd"
"stream" "stream"
"stt"
"subaru" "subaru"
"sun" "sun"
"surepetcare" "surepetcare"
"switch" "switch"
"switcher_kis"
"system_health" "system_health"
"system_log" "system_log"
"tado"
"tag" "tag"
"tasmota" "tasmota"
"tcp" "tcp"
"telegram"
"tellduslive"
"template" "template"
"tesla" "tesla"
"threshold" "threshold"
"tile"
"time_date" "time_date"
"timer" "timer"
"tod" "tod"
"tomato"
"toon"
"tplink"
"trace" "trace"
"transmission"
"trend"
"tts" "tts"
"tuya"
"twentemilieu"
"twilio"
"twinkly"
"twitch"
"uk_transport"
"unifi"
"unifi_direct"
"universal" "universal"
"updater" "updater"
"upnp" "upnp"
"uptime" "uptime"
"usgs_earthquakes_feed"
"utility_meter"
"uvc"
"vacuum" "vacuum"
"velbus"
"vera"
"verisure" "verisure"
"version" "version"
"vesync" "vesync"
"vizio"
"voicerss"
"volumio"
"vultr"
"wake_on_lan"
"water_heater"
"waze_travel_time"
"weather" "weather"
"webhook" "webhook"
"webostv"
"websocket_api" "websocket_api"
"wemo" "wemo"
"wiffi"
"wilight"
"wled" "wled"
"workday" "workday"
"worldclock" "worldclock"
"wsdot"
"wunderground"
"xiaomi"
"xiaomi_aqara"
"xiaomi_miio" "xiaomi_miio"
"yamaha"
"yandex_transport" "yandex_transport"
"yandextts"
"yeelight" "yeelight"
"zeroconf" "zeroconf"
"zerproc"
"zha" "zha"
"zodiac"
"zone" "zone"
"zwave" "zwave"
"zwave_js" "zwave_js"
@ -423,19 +650,35 @@ in with py.pkgs; buildPythonApplication rec {
]; ];
pytestFlagsArray = [ pytestFlagsArray = [
# limit amout of runners to reduce race conditions # parallelize test run
"-n auto" "--numprocesses auto"
# assign tests grouped by file to workers
"--dist loadfile"
# retry racy tests that end in "RuntimeError: Event loop is closed" # retry racy tests that end in "RuntimeError: Event loop is closed"
"--reruns 3" "--reruns 3"
"--only-rerun RuntimeError" "--only-rerun RuntimeError"
# assign tests grouped by file to workers
"--dist loadfile"
# enable full variable printing on error # enable full variable printing on error
"--showlocals" "--showlocals"
# tests are located in tests/
"tests"
# screenlogic/test_config_flow.py: Tries to send out UDP broadcasts # screenlogic/test_config_flow.py: Tries to send out UDP broadcasts
"--deselect tests/components/screenlogic/test_config_flow.py::test_form_cannot_connect" "--deselect tests/components/screenlogic/test_config_flow.py::test_form_cannot_connect"
# asuswrt/test_config_flow.py: Sandbox network limitations, fails with unexpected error
"--deselect tests/components/asuswrt/test_config_flow.py::test_on_connect_failed"
# shelly/test_config_flow.py: Tries to join multicast group
"--deselect tests/components/shelly/test_config_flow.py::test_form"
"--deselect tests/components/shelly/test_config_flow.py::test_title_without_name"
"--deselect tests/components/shelly/test_config_flow.py::test_form_auth"
"--deselect tests/components/shelly/test_config_flow.py::test_form_errors_test_connection"
"--deselect tests/components/shelly/test_config_flow.py::test_user_setup_ignored_device"
"--deselect tests/components/shelly/test_config_flow.py::test_form_auth_errors_test_connection"
"--deselect tests/components/shelly/test_config_flow.py::test_form_auth_errors_test_connection"
"--deselect tests/components/shelly/test_config_flow.py::test_form_auth_errors_test_connection"
"--deselect tests/components/shelly/test_config_flow.py::test_zeroconf"
"--deselect tests/components/shelly/test_config_flow.py::test_zeroconf_sleeping_device"
"--deselect tests/components/shelly/test_config_flow.py::test_zeroconf_sleeping_device_error"
"--deselect tests/components/shelly/test_config_flow.py::test_zeroconf_sleeping_device_error"
"--deselect tests/components/shelly/test_config_flow.py::test_zeroconf_require_auth"
# tests are located in tests/
"tests"
# dynamically add packages required for component tests # dynamically add packages required for component tests
] ++ map (component: "tests/components/" + component) componentTests; ] ++ map (component: "tests/components/" + component) componentTests;
@ -464,6 +707,9 @@ in with py.pkgs; buildPythonApplication rec {
"test_executor_shutdown_can_interrupt_threads" "test_executor_shutdown_can_interrupt_threads"
# {'theme_color': '#03A9F4'} != {'theme_color': 'blue'} # {'theme_color': '#03A9F4'} != {'theme_color': 'blue'}
"test_webhook_handle_get_config" "test_webhook_handle_get_config"
# onboarding tests rpi_power component, for which we are lacking rpi_bad_power library
"test_onboarding_core_sets_up_rpi_power"
"test_onboarding_core_no_rpi_power"
]; ];
preCheck = '' preCheck = ''
@ -472,6 +718,9 @@ in with py.pkgs; buildPythonApplication rec {
# the tests require the existance of a media dir # the tests require the existance of a media dir
mkdir /build/media mkdir /build/media
# put ping binary into PATH, e.g. for wake_on_lan tests
export PATH=${inetutils}/bin:$PATH
# error out when component test directory is missing, otherwise hidden by xdist execution :( # error out when component test directory is missing, otherwise hidden by xdist execution :(
for component in ${lib.concatStringsSep " " (map lib.escapeShellArg componentTests)}; do for component in ${lib.concatStringsSep " " (map lib.escapeShellArg componentTests)}; do
test -d "tests/components/$component" || { test -d "tests/components/$component" || {