From: Jouni Malinen Date: Sun, 3 Feb 2019 15:16:28 +0000 (+0200) Subject: tests: python3 compatible way of importing gobject for D-Bus testing X-Git-Tag: hostap_2_8~452 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c9ba3412d265071e09a6c59e0211e801fa33d0e;p=thirdparty%2Fhostap.git tests: python3 compatible way of importing gobject for D-Bus testing Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index 338c1dd90..0e690fab3 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -9,9 +9,13 @@ import logging logger = logging.getLogger() import subprocess import time +import sys try: - import gobject + if sys.version_info[0] > 2: + from gi.repository import GObject as gobject + else: + import gobject import dbus dbus_imported = True except ImportError: diff --git a/tests/hwsim/test_dbus_old.py b/tests/hwsim/test_dbus_old.py index bb6043e7e..4e132a0d4 100644 --- a/tests/hwsim/test_dbus_old.py +++ b/tests/hwsim/test_dbus_old.py @@ -6,9 +6,13 @@ import logging logger = logging.getLogger() +import sys try: - import gobject + if sys.version_info[0] > 2: + from gi.repository import GObject as gobject + else: + import gobject import dbus dbus_imported = True except ImportError: