diff --git a/src/modules/displaymanager/tests/test-dm-greetd.py b/src/modules/displaymanager/tests/test-dm-greetd.py
index d41c2dadf02bda917ead4d5285f9c068aab4315a..e2682afc7c54fc74f45aa800042d243217cca3a8 100644
--- a/src/modules/displaymanager/tests/test-dm-greetd.py
+++ b/src/modules/displaymanager/tests/test-dm-greetd.py
@@ -17,6 +17,14 @@ try:
 except FileNotFoundError as e:
     pass
 
+try:
+    import toml
+except ImportError:
+    # This is a failure of the test-environment.
+    import sys
+    print("Can't find module toml.", file=sys.stderr)
+    sys.exit(0)
+
 # Specific DM test
 d = main.DMgreetd("/tmp")
 d.set_autologin("d", True, default_desktop_environment)