mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-30 20:33:08 +02:00
Merge branch 'imports' into 'master'
Don't fail a test if optional dependencies are not present Closes #2083 See merge request GNOME/glib!1448
This commit is contained in:
commit
fecaa5a5ea
@ -14,24 +14,27 @@ __license__ = 'LGPL 3+'
|
||||
import unittest
|
||||
import sys
|
||||
import subprocess
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
import dbusmock
|
||||
import fcntl
|
||||
import os
|
||||
import time
|
||||
|
||||
import taptestrunner
|
||||
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gio
|
||||
try:
|
||||
# Do all non-standard imports here so we can skip the tests if any
|
||||
# needed packages are not available.
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
import dbusmock
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gio
|
||||
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
|
||||
# XDG_DESKTOP_PORTAL_PATH = os.path.expanduser("~/.cache/jhbuild/build/xdg-desktop-portal/xdg-desktop-portal")
|
||||
XDG_DESKTOP_PORTAL_PATH = "@libexecdir@/xdg-desktop-portal"
|
||||
# XDG_DESKTOP_PORTAL_PATH = os.path.expanduser("~/.cache/jhbuild/build/xdg-desktop-portal/xdg-desktop-portal")
|
||||
XDG_DESKTOP_PORTAL_PATH = "@libexecdir@/xdg-desktop-portal"
|
||||
|
||||
class TestLowMemoryMonitor(dbusmock.DBusTestCase):
|
||||
class TestLowMemoryMonitor(dbusmock.DBusTestCase):
|
||||
'''Test GMemoryMonitorDBus'''
|
||||
|
||||
@classmethod
|
||||
@ -98,6 +101,11 @@ class TestLowMemoryMonitor(dbusmock.DBusTestCase):
|
||||
self.main_context.iteration(False)
|
||||
self.assertEqual(self.last_warning, 255)
|
||||
|
||||
except ImportError as e:
|
||||
@unittest.skip("Cannot import %s" % e.name)
|
||||
class TestLowMemoryMonitor(unittest.TestCase):
|
||||
def test_low_memory_warning_signal(self):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(testRunner=taptestrunner.TAPTestRunner())
|
||||
|
@ -14,24 +14,27 @@ __license__ = 'LGPL 3+'
|
||||
import unittest
|
||||
import sys
|
||||
import subprocess
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
import dbusmock
|
||||
import fcntl
|
||||
import os
|
||||
import time
|
||||
|
||||
import taptestrunner
|
||||
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gio
|
||||
try:
|
||||
# Do all non-standard imports here so we can skip the tests if any
|
||||
# needed packages are not available.
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
import dbusmock
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gio
|
||||
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
|
||||
# XDG_DESKTOP_PORTAL_PATH = os.path.expanduser("~/.cache/jhbuild/build/xdg-desktop-portal/xdg-desktop-portal")
|
||||
XDG_DESKTOP_PORTAL_PATH = "@libexecdir@/xdg-desktop-portal"
|
||||
# XDG_DESKTOP_PORTAL_PATH = os.path.expanduser("~/.cache/jhbuild/build/xdg-desktop-portal/xdg-desktop-portal")
|
||||
XDG_DESKTOP_PORTAL_PATH = "@libexecdir@/xdg-desktop-portal"
|
||||
|
||||
class TestLowMemoryMonitorPortal(dbusmock.DBusTestCase):
|
||||
class TestLowMemoryMonitorPortal(dbusmock.DBusTestCase):
|
||||
'''Test GMemoryMonitorPortal'''
|
||||
|
||||
@classmethod
|
||||
@ -114,6 +117,11 @@ class TestLowMemoryMonitorPortal(dbusmock.DBusTestCase):
|
||||
self.main_context.iteration(False)
|
||||
self.assertEqual(self.last_warning, 255)
|
||||
|
||||
except ImportError as e:
|
||||
@unittest.skip("Cannot import %s" % e.name)
|
||||
class TestLowMemoryMonitorPortal(unittest.TestCase):
|
||||
def test_low_memory_warning_portal_signal(self):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(testRunner=taptestrunner.TAPTestRunner())
|
||||
|
Loading…
x
Reference in New Issue
Block a user