From 9301693c8385f7b1703a622eeb403034897ff619 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Sat, 19 Dec 2020 18:01:00 +0100 Subject: [PATCH] tests: Allow use of other virtual devices --- tests/fprintd.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/fprintd.py b/tests/fprintd.py index 8ab9eec..fff303d 100755 --- a/tests/fprintd.py +++ b/tests/fprintd.py @@ -123,6 +123,8 @@ ctx = GLib.main_context_default() class FPrintdTest(dbusmock.DBusTestCase): + socket_env = 'FP_VIRTUAL_IMAGE' + @staticmethod def path_from_service_file(sf): with open(SERVICE_FILE) as f: @@ -159,7 +161,7 @@ class FPrintdTest(dbusmock.DBusTestCase): cls.tmpdir = tempfile.mkdtemp(prefix='libfprint-') cls.sockaddr = os.path.join(cls.tmpdir, 'virtual-image.socket') - os.environ['FP_VIRTUAL_IMAGE'] = cls.sockaddr + os.environ[cls.socket_env] = cls.sockaddr cls.prints = {} for f in glob.glob(os.path.join(imgdir, '*.png')): @@ -187,7 +189,7 @@ class FPrintdTest(dbusmock.DBusTestCase): dbusmock.DBusTestCase.tearDownClass() - def daemon_start(self): + def daemon_start(self, driver='Virtual image device'): timeout = get_timeout('daemon_start') # seconds env = os.environ.copy() env['G_DEBUG'] = 'fatal-criticals' @@ -234,7 +236,7 @@ class FPrintdTest(dbusmock.DBusTestCase): 'net.reactivated.Fprint.Device', None) - if 'Virtual image device' in str(dev.get_cached_property('name')): + if driver in str(dev.get_cached_property('name')): self.device = dev break else: