diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2022-06-08 14:44:05 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2022-06-13 09:29:29 +1000 |
commit | d5b61195553094f316015facb0d7a7ac2954d1b2 (patch) | |
tree | 6a10cda8a22195a9c20a42c472f99969f47b1843 | |
parent | c44522c1f2c4487e1629435aa45b545c1d0279e9 (diff) | |
download | xf86-input-wacom-d5b61195553094f316015facb0d7a7ac2954d1b2.tar.gz |
test: raise an InputError with better info if modules are missing
The tests need to run as root (for uinput/evdev) so pip-installing a
package as user gets past the build check but then fails at runtime.
Let's make this bit easier to debug.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | test/__init__.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/__init__.py b/test/__init__.py index 5f9a482..02d78ad 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -17,12 +17,20 @@ from typing import Dict, List, Union from pathlib import Path -import attr import enum -import pytest -import libevdev import logging -import yaml + +try: + import attr + import pytest + import libevdev + import yaml +except ImportError as e: + print("One or more modules are missing.") + print( + "PIP-installed packages must be installed as root if the test suite is run as root" + ) + raise (e) import gi |