about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2023-02-20 17:01:02 +0100
committerMartin Weinelt <hexa@darmstadt.ccc.de>2023-02-20 18:37:20 +0100
commit9bf8744a732fad91482a66c28c5462a683be727c (patch)
tree4c242acd5c939e15cceaec25dd4e1dcd81a3c62b /nixos/tests
parente01ccd6245fe1fe34aa49aa48fe3d53e3b013c20 (diff)
nixos/tests/home-assistant: Check dependencies arrive in the PYTHONPATH
Both extraPackages and derived packages from extraComponents should
be present in the units PYTHONPATH environment variable.
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/home-assistant.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/tests/home-assistant.nix b/nixos/tests/home-assistant.nix
index 0c2176c261cfb..aec4784e9c5ff 100644
--- a/nixos/tests/home-assistant.nix
+++ b/nixos/tests/home-assistant.nix
@@ -132,6 +132,12 @@ in {
         return out
 
 
+    def get_unit_property(property) -> str:
+        exit, out = hass.execute(f"systemctl show --property={property} home-assistant.service")
+        assert exit == 0
+        return out
+
+
     def wait_for_homeassistant(cursor):
         hass.wait_until_succeeds(f"journalctl --after-cursor='{cursor}' -u home-assistant.service | grep -q 'Home Assistant initialized in'")
 
@@ -150,6 +156,12 @@ in {
         hass.wait_for_open_port(8123)
         hass.succeed("curl --fail http://localhost:8123/lovelace")
 
+    with subtest("Check that optional dependencies are in the PYTHONPATH"):
+        env = get_unit_property("Environment")
+        python_path = env.split("PYTHONPATH=")[1].split()[0]
+        for package in ["colorama", "paho-mqtt", "psycopg2"]:
+            assert package in python_path, f"{package} not in PYTHONPATH"
+
     with subtest("Check that declaratively configured components get setup"):
         journal = get_journal_since(cursor)
         for domain in ["emulated_hue", "wake_on_lan"]: