diff options
author | Simon Feltman <sfeltman@src.gnome.org> | 2014-03-03 04:51:09 -0800 |
---|---|---|
committer | Simon Feltman <sfeltman@src.gnome.org> | 2014-03-03 04:51:09 -0800 |
commit | ad680ae9c37a0091628a7d66010fbf70aa1a2e43 (patch) | |
tree | 2d39df6ca7601c363a223a3e4b755834d47ec204 | |
parent | 45d45e7c2704d68a3008f739e501fa332d326b8b (diff) | |
download | pygobject-ad680ae9c37a0091628a7d66010fbf70aa1a2e43.tar.gz |
tests: Move class definition depending on GTK+ within function evaluation
Move the definition of WindowWithSizeAllocOverride inside of the test
function call to so it is lazily defined. This avoids problems running tests
on systems without GTK+ installed.
-rw-r--r-- | tests/test_overrides_gtk.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py index 210cf450..2a0fd905 100644 --- a/tests/test_overrides_gtk.py +++ b/tests/test_overrides_gtk.py @@ -633,26 +633,26 @@ class TestGtk(unittest.TestCase): @unittest.skipUnless(Gtk, 'Gtk not available') class TestSignals(unittest.TestCase): - class WindowWithSizeAllocOverride(Gtk.ScrolledWindow): - __gsignals__ = {'size-allocate': 'override'} + def test_class_closure_override_with_aliased_type(self): + class WindowWithSizeAllocOverride(Gtk.ScrolledWindow): + __gsignals__ = {'size-allocate': 'override'} - def __init__(self): - Gtk.ScrolledWindow.__init__(self) - self._alloc_called = False - self._alloc_value = None - self._alloc_error = None + def __init__(self): + Gtk.ScrolledWindow.__init__(self) + self._alloc_called = False + self._alloc_value = None + self._alloc_error = None - def do_size_allocate(self, alloc): - self._alloc_called = True - self._alloc_value = alloc + def do_size_allocate(self, alloc): + self._alloc_called = True + self._alloc_value = alloc - try: - Gtk.ScrolledWindow.do_size_allocate(self, alloc) - except Exception as e: - self._alloc_error = e + try: + Gtk.ScrolledWindow.do_size_allocate(self, alloc) + except Exception as e: + self._alloc_error = e - def test_class_closure_override_with_aliased_type(self): - win = self.WindowWithSizeAllocOverride() + win = WindowWithSizeAllocOverride() rect = Gdk.Rectangle() rect.width = 100 rect.height = 100 |