From 266cdceff7798e73271e1b8a89e9f0fbd1ec5006 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 18 May 2021 01:03:27 +0200 Subject: [PATCH 1/6] home-assistant: update component packages with pygatt --- pkgs/servers/home-assistant/component-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index a45981227776..854b476bbc75 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -89,7 +89,7 @@ "bloomsky" = ps: with ps; [ ]; "blueprint" = ps: with ps; [ ]; "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 ]; "bme280" = ps: with ps; [ smbus-cffi ]; # missing inputs: i2csense "bme680" = ps: with ps; [ bme680 smbus-cffi ]; @@ -755,7 +755,7 @@ "sinch" = ps: with ps; [ ]; # missing inputs: clx-sdk-xms "sisyphus" = ps: with ps; [ ]; # missing inputs: sisyphus-control "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 ]; "slack" = ps: with ps; [ slackclient ]; "sleepiq" = ps: with ps; [ sleepyq ]; From f6b1fc2996dc6391bf8ddc792958ca84ae029a7c Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 18 May 2021 01:50:01 +0200 Subject: [PATCH 2/6] home-assistant: pin pyflunearyou at 1.0.7 --- pkgs/servers/home-assistant/default.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 52b049e4576f..1d133ca7d531 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -55,6 +55,25 @@ let (mkOverride "ring-doorbell" "0.6.2" "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 pyruckus>0.12 (self: super: { pyruckus = super.pyruckus.overridePythonAttrs (oldAttrs: rec { From a1a1a6b1dfa426e5e6d8141a7c5b93b2d0de90b0 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 18 May 2021 01:58:52 +0200 Subject: [PATCH 3/6] home-assistant: pin pyopenuv at 1.0.13 --- pkgs/servers/home-assistant/default.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 1d133ca7d531..3ec777745ab3 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -74,6 +74,23 @@ let }); }) + # 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 (self: super: { pyruckus = super.pyruckus.overridePythonAttrs (oldAttrs: rec { From 344573771e79863323a1d2119f09ea5e27434227 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 18 May 2021 02:37:54 +0200 Subject: [PATCH 4/6] home-assistant: pin pylast at 4.2.0 The following test failure occurs with 4.2.1, due to `network` not being allowed to be None after https://github.com/pylast/pylast/commit/6fe9aa632b2147eaf7278230def9ea735eb73f4e. _________________________ test_update_playing[pyloop] __________________________ [gw20] linux -- Python 3.8.9 /nix/store/hq6mrm0pc6xn6j8y6lm4qcgg9rwmqd8q-python3-3.8.9/bin/python3.8 hass = lastfm_network = async def test_update_playing(hass, lastfm_network): """Test update when song playing.""" lastfm_network.return_value.get_user.return_value = MockUser( > Track("artist", "title", None) ) hass = lastfm_network = tests/components/lastfm/test_sensor.py:70: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /nix/store/f0ci60zk59rz5767l9lfy7q767zna6j5-python3.8-pylast-4.2.1/lib/python3.8/site-packages/pylast/__init__.py:2095: in __init__ super().__init__(artist, title, network, "track", username, info) __class__ = artist = 'artist' info = None network = None self = pylast.Track('artist', 'title', None) title = 'title' username = None _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pylast.Track('artist', 'title', None), artist = 'artist', title = 'title' network = None, ws_prefix = 'track', username = None, info = {} def __init__(self, artist, title, network, ws_prefix, username=None, info=None): """ Create an opus instance. # Parameters: * artist: An artist name or an Artist object. * title: The album or track title. * ws_prefix: 'album' or 'track' """ if info is None: info = {} super().__init__(network=network, ws_prefix=ws_prefix) if isinstance(artist, Artist): self.artist = artist else: self.artist = Artist(artist, self.network) self.title = title self.username = ( > username if username else network.username ) # Default to current user E AttributeError: 'NoneType' object has no attribute 'username' __class__ = artist = 'artist' info = {} network = None self = pylast.Track('artist', 'title', None) title = 'title' username = None ws_prefix = 'track' /nix/store/f0ci60zk59rz5767l9lfy7q767zna6j5-python3.8-pylast-4.2.1/lib/python3.8/site-packages/pylast/__init__.py:1520: AttributeError --- pkgs/servers/home-assistant/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 3ec777745ab3..b648520a9feb 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -74,6 +74,10 @@ let }); }) + # 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 { From c53ab92c047318be3ce32a404ddf1c09b86419c4 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 18 May 2021 02:42:45 +0200 Subject: [PATCH 5/6] python3Packages.pyflume: 0.6.4 -> 0.7.0 --- pkgs/development/python-modules/pyflume/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pyflume/default.nix b/pkgs/development/python-modules/pyflume/default.nix index 7c80aab59cda..075297794b21 100644 --- a/pkgs/development/python-modules/pyflume/default.nix +++ b/pkgs/development/python-modules/pyflume/default.nix @@ -12,14 +12,14 @@ buildPythonPackage rec { pname = "pyflume"; - version = "0.6.4"; + version = "0.7.0"; disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "ChrisMandich"; repo = "PyFlume"; rev = "v${version}"; - sha256 = "1dm560hh6fl1waiwsq8m31apmvvwhc3y95bfdb7449bs8k96dmxq"; + sha256 = "129sz33a270v120bzl9l98nmvdzn7ns4cf9w2v18lmzlldbyz2vn"; }; prePatch = '' From 27cc2b105f946fddceb7ca1e5eb77b58ebf5b4d2 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 18 May 2021 02:43:52 +0200 Subject: [PATCH 6/6] home-assistant: enable tests for components with packaged dependencies --- pkgs/servers/home-assistant/default.nix | 237 ++++++++++++++++++++++-- 1 file changed, 223 insertions(+), 14 deletions(-) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index b648520a9feb..bb5af00bb8fc 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -2,6 +2,7 @@ , lib , fetchFromGitHub , python3 +, inetutils , nixosTests # Look up dependencies of specified components in component-packages.nix @@ -239,33 +240,69 @@ in with py.pkgs; buildPythonApplication rec { # services. Before adding new components to this list make sure we have all # its dependencies packaged and listed in ./component-packages.nix. componentTests = [ + "abode" "accuweather" + "acmeda" + "adguard" + "advantage_air" + "agent_dvr" + "air_quality" "airly" + "airnow" + "airvisual" + "alarm_control_panel" + "alarmdecoder" + "alert" + "alexa" + "almond" + "ambiclimate" + "ambient_station" "analytics" "androidtv" - "alert" + "apache_kafka" "api" + "apple_tv" + "apprise" + "arlo" + "asuswrt" + "august" + "aurora" "auth" "automation" + "awair" + "aws" "axis" "bayesian" "binary_sensor" + "blackbird" + "blueprint" + "bluetooth_le_tracker" + "braviatv" + "broadlink" "brother" + "bsblan" "caldav" "calendar" "camera" "canary" "cast" + "cert_expiry" "climacell" "climate" "cloud" + "cloudflare" "comfoconnect" "command_line" + "compensation" "config" "configurator" "conversation" + "coronavirus" "counter" "cover" + "daikin" + "darksky" + "datadog" "deconz" "default_config" "demo" @@ -275,22 +312,42 @@ in with py.pkgs; buildPythonApplication rec { "device_sun_light_trigger" "device_tracker" "devolo_home_control" + "dexcom" "dhcp" + "dialogflow" "discovery" "dsmr" + "dte_energy_bridge" + "duckdns" + "dyson" + "eafm" "econet" + "efergy" + "emonitor" "emulated_hue" "esphome" - "fan" + "everlights" + "ezviz" "faa_delays" + "facebook" + "facebox" + "fail2ban" + "fan" + "feedreader" "ffmpeg" + "fido" "file" "filesize" "filter" + "firmata" + "flo" + "flume" + "flunearyou" "flux" "folder" "folder_watcher" "freebox" + "freedns" "fritz" "fritzbox" "fritzbox_callmonitor" @@ -299,59 +356,97 @@ in with py.pkgs; buildPythonApplication rec { "generic_thermostat" "geo_json_events" "geo_location" + "geofency" + "glances" + "google" + "google_assistant" + "google_domains" + "google_pubsub" + "google_translate" + "google_travel_time" + "google_wifi" + "gpslogger" + "graphite" "group" + "guardian" + "harmony" + "hassio" "hddtemp" "history" "history_stats" "home_connect" "home_plus_control" + "homeassistant" "homekit" "homekit_controller" - "homeassistant" "homematic" "homematicip_cloud" "html5" "http" "hue" + "humidifier" "hyperion" + "ialarm" "iaqualink" + "icloud" "ifttt" "image" "image_processing" + "imap_email_content" "influxdb" "input_boolean" "input_datetime" - "input_text" "input_number" "input_select" + "input_text" + "insteon" + "integration" "intent" "intent_script" + "ios" "ipp" + "iqvia" "islamic_prayer_times" "jewish_calendar" + "kira" "kmtronic" "knx" "kodi" + "lastfm" + "lcn" "light" "litterrobot" "local_file" "local_ip" + "locative" "lock" "logbook" "logentries" "logger" + "london_air" "lovelace" + "luftdaten" "lutron_caseta" + "lyric" + "mailbox" "manual" "manual_mqtt" "mazda" "media_player" "media_source" + "meraki" "met" "met_eireann" + "microsoft_face" + "microsoft_face_detect" + "microsoft_face_identify" + "mikrotik" + "min_max" "minecraft_server" + "minio" "mobile_app" "modbus" + "mold_indicator" "moon" "motioneye" "mqtt" @@ -361,33 +456,66 @@ in with py.pkgs; buildPythonApplication rec { "mqtt_statestream" "mullvad" "mutesync" + "my" + "myq" + "mysensors" + "namecheapdns" + "neato" + "netatmo" "nexia" + "no_ip" "notify" "notion" + "nuki" "number" + "nws" "nx584" "omnilogic" + "onboarding" "ondilo_ico" + "openalpr_cloud" + "openalpr_local" "openerz" + "openhardwaremonitor" "opentherm_gw" + "openuv" + "openweathermap" + "opnsense" "ovo_energy" + "owntracks" "ozw" "panel_custom" "panel_iframe" "persistent_notification" "person" "philips_js" + "pi_hole" + "picnic" + "ping" "plaato" + "plant" + "plex" "plugwise" + "poolsense" + "profiler" "prometheus" "proximity" "push" + "pushbullet" "pvpc_hourly_pricing" "python_script" + "rachio" + "radarr" + "rainmachine" "random" + "recollect_waste" "recorder" + "reddit" + "remote" "rest" "rest_command" + "ring" + "risco" "rituals_perfume_genie" "rmvtransport" "roku" @@ -395,66 +523,125 @@ in with py.pkgs; buildPythonApplication rec { "rss_feed_template" "ruckus_unleashed" "safe_mode" + "samsungtv" "scene" "screenlogic" "script" "search" + "season" + "sensor" + "sentry" + "sharkiq" "shell_command" + "shelly" "shopping_list" + "sigfox" + "sighthound" "simplisafe" "simulated" + "slack" "sleepiq" "sma" - "smhi" - "sensor" - "slack" + "smappee" "smartthings" "smarttub" + "smhi" "smtp" - "smappee" + "snips" "solaredge" + "soma" + "somfy" "sonos" + "soundtouch" + "spaceapi" + "speedtestdotnet" "spotify" "sql" + "squeezebox" "ssdp" + "startca" + "statistics" + "statsd" "stream" + "stt" "subaru" "sun" "surepetcare" "switch" + "switcher_kis" "system_health" "system_log" + "tado" "tag" "tasmota" "tcp" + "telegram" + "tellduslive" "template" "tesla" "threshold" + "tile" "time_date" "timer" "tod" + "tomato" + "toon" + "tplink" "trace" + "transmission" + "trend" "tts" + "tuya" + "twentemilieu" + "twilio" + "twinkly" + "twitch" + "uk_transport" + "unifi" + "unifi_direct" "universal" "updater" "upnp" "uptime" + "usgs_earthquakes_feed" + "utility_meter" + "uvc" "vacuum" + "velbus" + "vera" "verisure" "version" "vesync" + "vizio" + "voicerss" + "volumio" + "vultr" + "wake_on_lan" + "water_heater" + "waze_travel_time" "weather" "webhook" + "webostv" "websocket_api" "wemo" + "wiffi" + "wilight" "wled" "workday" "worldclock" + "wsdot" + "wunderground" + "xiaomi" + "xiaomi_aqara" "xiaomi_miio" + "yamaha" "yandex_transport" + "yandextts" "yeelight" "zeroconf" + "zerproc" "zha" + "zodiac" "zone" "zwave" "zwave_js" @@ -463,19 +650,35 @@ in with py.pkgs; buildPythonApplication rec { ]; pytestFlagsArray = [ - # limit amout of runners to reduce race conditions - "-n auto" + # parallelize test run + "--numprocesses auto" + # assign tests grouped by file to workers + "--dist loadfile" # retry racy tests that end in "RuntimeError: Event loop is closed" "--reruns 3" "--only-rerun RuntimeError" - # assign tests grouped by file to workers - "--dist loadfile" # enable full variable printing on error "--showlocals" - # tests are located in tests/ - "tests" # screenlogic/test_config_flow.py: Tries to send out UDP broadcasts "--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 ] ++ map (component: "tests/components/" + component) componentTests; @@ -504,6 +707,9 @@ in with py.pkgs; buildPythonApplication rec { "test_executor_shutdown_can_interrupt_threads" # {'theme_color': '#03A9F4'} != {'theme_color': 'blue'} "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 = '' @@ -512,6 +718,9 @@ in with py.pkgs; buildPythonApplication rec { # the tests require the existance of a media dir 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 :( for component in ${lib.concatStringsSep " " (map lib.escapeShellArg componentTests)}; do test -d "tests/components/$component" || {