summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2022-01-20 13:53:16 +0100
committerBastien Nocera <hadess@hadess.net>2022-01-20 13:53:16 +0100
commitc3d49d2d4a24e9daf931370d24413f857985b087 (patch)
tree5b95395e4ba177da0bd456e09bce4ddbc5032943 /tests
parent54aef5abf276f27b94670ea5c8553433aee08128 (diff)
downloadgnome-bluetooth-c3d49d2d4a24e9daf931370d24413f857985b087.tar.gz
tests: Only load GnomeBluetoothPriv when running tests
Not when loading the script
Diffstat (limited to 'tests')
-rwxr-xr-xtests/integration-test.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/integration-test.py b/tests/integration-test.py
index a79066ef..543f3876 100755
--- a/tests/integration-test.py
+++ b/tests/integration-test.py
@@ -35,18 +35,18 @@ except ImportError as e:
sys.stderr.write('Skipping tests, PyGobject not available for Python 3, or missing GI typelibs: %s\n' % str(e))
sys.exit(77)
-try:
- gi.require_version('GIRepository', '2.0')
- from gi.repository import GIRepository
- builddir = os.getenv('top_builddir', '.')
- GIRepository.Repository.prepend_library_path(builddir + '/lib/')
- GIRepository.Repository.prepend_search_path(builddir + '/lib/')
+gi.require_version('GIRepository', '2.0')
+from gi.repository import GIRepository
+builddir = os.getenv('top_builddir', '.')
+GIRepository.Repository.prepend_library_path(builddir + '/lib/')
+GIRepository.Repository.prepend_search_path(builddir + '/lib/')
+GNOME_BLUETOOTH_PRIV_UNAVAILABLE = False
+try:
gi.require_version('GnomeBluetoothPriv', '3.0')
from gi.repository import GnomeBluetoothPriv
-except ImportError as e:
- sys.stderr.write('Could not find GnomeBluetoothPriv gobject-introspection data in the build dir: %s\n' % str(e))
- sys.exit(1)
+except (ImportError, ValueError) as e:
+ GNOME_BLUETOOTH_PRIV_UNAVAILABLE = True
try:
import dbusmock
@@ -58,6 +58,10 @@ except ImportError:
class OopTests(dbusmock.DBusTestCase):
@classmethod
def setUp(self):
+ if GNOME_BLUETOOTH_PRIV_UNAVAILABLE:
+ sys.stderr.write('Could not find GnomeBluetoothPriv gobject-introspection data in the build dir: %s\n' % str(e))
+ sys.exit(1)
+
self.client = GnomeBluetoothPriv.Client.new()
# used in test_pairing
self.paired = False