| 1 |
import os.path |
| 2 |
import pkgutil |
| 3 |
from unittest import TestCase, TestSuite |
| 4 |
|
| 5 |
from gi.repository import Gdk, GdkX11 |
| 6 |
|
| 7 |
|
| 8 |
fake_x11_screen = GdkX11.X11Screen() |
| 9 |
Gdk.Screen.get_default = lambda: fake_x11_screen |
| 10 |
|
| 11 |
|
| 12 |
class TestImports(TestCase): |
| 13 |
def __init__(self, mod_name): |
| 14 |
name = f"test_{mod_name.replace('.', '_')}_import" |
| 15 |
|
| 16 |
def f(): |
| 17 |
__import__(mod_name) |
| 18 |
|
| 19 |
setattr(self, name, f) |
| 20 |
super().__init__(name) |
| 21 |
|
| 22 |
|
| 23 |
def load_tests(*_args): |
| 24 |
test_cases = TestSuite() |
| 25 |
home = os.path.dirname(os.path.dirname(__file__)) |
| 26 |
for package in pkgutil.walk_packages([f"{home}/blueman"], "blueman."): |
| 27 |
test_cases.addTest(TestImports(package.name)) |
| 28 |
|
| 29 |
assert test_cases.countTestCases() > 0 |
| 30 |
|
| 31 |
return test_cases |