[pygobject] tests: Move class definition depending on GTK+ within function evaluation
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] tests: Move class definition depending on GTK+ within function evaluation
- Date: Mon, 3 Mar 2014 12:54:58 +0000 (UTC)
commit ad680ae9c37a0091628a7d66010fbf70aa1a2e43
Author: Simon Feltman <sfeltman src gnome org>
Date: Mon Mar 3 04:51:09 2014 -0800
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.
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 210cf45..2a0fd90 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]