home-assistant: enable a lot more component tests

We can now track a list of components, that should be integrated into
our testsuite run. Their dependencies will automatically be included
into the checkInputs by reusing the dependency lookup infrastructure we
already have, which is what makes this feasible.
This commit is contained in:
Martin Weinelt 2021-02-06 04:47:04 +01:00
parent b2e2f0422f
commit 4e65797018
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759

View File

@ -127,6 +127,8 @@ in with py.pkgs; buildPythonApplication rec {
yarl yarl
] ++ componentBuildInputs ++ extraBuildInputs; ] ++ componentBuildInputs ++ extraBuildInputs;
makeWrapperArgs = lib.optional skipPip "--add-flags --skip-pip";
# upstream only tests on Linux, so do we. # upstream only tests on Linux, so do we.
doCheck = stdenv.isLinux; doCheck = stdenv.isLinux;
@ -139,49 +141,151 @@ in with py.pkgs; buildPythonApplication rec {
requests-mock requests-mock
# component dependencies # component dependencies
pyotp pyotp
respx
] ++ lib.concatMap (component: getPackages component py.pkgs) componentTests; ] ++ lib.concatMap (component: getPackages component py.pkgs) componentTests;
# We cannot test all components, since they'd introduce lots of dependencies, some of which are unpackaged, # We can reasonably test components that don't communicate with any network
# but we should test very common stuff, like what's in `default_config`. # services. Before adding new components to this list make sure we have all
# https://github.com/home-assistant/core/commits/dev/homeassistant/components/default_config/manifest.json # its dependencies packaged and listed in ./component-packages.nix.
componentTests = [ componentTests = [
"alert"
"api" "api"
"auth"
"automation" "automation"
"bayesian"
"binary_sensor"
"caldav"
"calendar"
"camera"
"climate"
"cloud"
"command_line"
"config" "config"
"configurator" "configurator"
"conversation"
"counter" "counter"
"cover"
"default_config" "default_config"
"demo" "demo"
"derivative"
"device_automation"
"device_sun_light_trigger"
"device_tracker"
"dhcp" "dhcp"
"discovery" "discovery"
"emulated_hue"
"esphome"
"fan"
"ffmpeg"
"file"
"filesize"
"filter"
"flux"
"folder"
"folder_watcher"
"fritzbox"
"fritzbox_callmonitor"
"frontend" "frontend"
"generic"
"generic_thermostat"
"geo_json_events"
"geo_location"
"group" "group"
"hddtemp"
"history" "history"
"history_stats"
"homeassistant" "homeassistant"
"html5"
"http" "http"
"hue" "hue"
"ifttt"
"image"
"image_processing"
"influxdb"
"input_boolean" "input_boolean"
"input_datetime" "input_datetime"
"input_text" "input_text"
"input_number" "input_number"
"input_select" "input_select"
"intent"
"intent_script"
"ipp"
"light"
"local_file"
"local_ip"
"lock"
"logbook" "logbook"
"logentries"
"logger" "logger"
"lovelace"
"manual"
"manual_mqtt"
"media_player"
"media_source" "media_source"
"met"
"mobile_app" "mobile_app"
"modbus"
"moon"
"mqtt"
"mqtt_eventstream"
"mqtt_json"
"mqtt_room"
"mqtt_statestream"
"notify"
"number"
"ozw"
"panel_custom"
"panel_iframe"
"persistent_notification"
"person" "person"
"prometheus"
"proximity"
"push"
"python_script"
"random"
"recorder"
"rest"
"rest_command"
"rmvtransport"
"rss_feed_template"
"safe_mode"
"scene" "scene"
"script" "script"
"search"
"shell_command" "shell_command"
"shopping_list"
"simulated"
"sensor"
"smtp"
"sql"
"ssdp" "ssdp"
"stream"
"sun" "sun"
"switch"
"system_health" "system_health"
"system_log" "system_log"
"tag" "tag"
"tasmota"
"tcp"
"template"
"threshold"
"time_date"
"timer" "timer"
"tod"
"tts"
"universal"
"updater"
"upnp"
"uptime"
"vacuum"
"weather"
"webhook" "webhook"
"websocket_api" "websocket_api"
"wled"
"workday"
"worldclock"
"zeroconf" "zeroconf"
"zha"
"zone" "zone"
"zwave" "zwave"
]; ];
@ -191,13 +295,18 @@ in with py.pkgs; buildPythonApplication rec {
"-n 2" "-n 2"
# assign tests grouped by file to workers # assign tests grouped by file to workers
"--dist loadfile" "--dist loadfile"
# don't bulk test all components # tests are located in tests/
"--ignore tests/components"
# pyotp since v2.4.0 complains about the short mock keys, hass pins v2.3.0
"--ignore tests/auth/mfa_modules/test_notify.py"
"tests" "tests"
# dynamically add packages required for component tests
] ++ map (component: "tests/components/" + component) componentTests; ] ++ map (component: "tests/components/" + component) componentTests;
disabledTestPaths = [
# don't bulk test all components
"tests/components"
# pyotp since v2.4.0 complains about the short mock keys, hass pins v2.3.0
"tests/auth/mfa_modules/test_notify.py"
];
disabledTests = [ disabledTests = [
# AssertionError: assert 1 == 0 # AssertionError: assert 1 == 0
"test_merge" "test_merge"
@ -213,8 +322,6 @@ in with py.pkgs; buildPythonApplication rec {
mkdir /build/media mkdir /build/media
''; '';
makeWrapperArgs = lib.optional skipPip "--add-flags --skip-pip";
passthru = { passthru = {
inherit (py.pkgs) hass-frontend; inherit (py.pkgs) hass-frontend;
tests = { tests = {