tests: python3 compatible way of importing gobject for D-Bus testing

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-02-03 17:16:28 +02:00
parent 236bbda8e4
commit 5c9ba3412d
2 changed files with 10 additions and 2 deletions

View file

@ -9,9 +9,13 @@ import logging
logger = logging.getLogger() logger = logging.getLogger()
import subprocess import subprocess
import time import time
import sys
try: try:
import gobject if sys.version_info[0] > 2:
from gi.repository import GObject as gobject
else:
import gobject
import dbus import dbus
dbus_imported = True dbus_imported = True
except ImportError: except ImportError:

View file

@ -6,9 +6,13 @@
import logging import logging
logger = logging.getLogger() logger = logging.getLogger()
import sys
try: try:
import gobject if sys.version_info[0] > 2:
from gi.repository import GObject as gobject
else:
import gobject
import dbus import dbus
dbus_imported = True dbus_imported = True
except ImportError: except ImportError: