Merge lp:~nataliabidart/ubuntuone-control-panel/gicrazyness into lp:ubuntuone-control-panel

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 261
Merged at revision: 257
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/gicrazyness
Merge into: lp:ubuntuone-control-panel
Diff against target: 213 lines (+36/-39)
5 files modified
run-tests (+20/-15)
ubuntuone/controlpanel/gui/gtk/gui.py (+6/-4)
ubuntuone/controlpanel/gui/gtk/tests/__init__.py (+1/-10)
ubuntuone/controlpanel/gui/gtk/tests/test_gui_basic.py (+7/-8)
ubuntuone/controlpanel/logger.py (+2/-2)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/gicrazyness
Reviewer Review Type Date Requested Status
dobey (community) Approve
Review via email: mp+91708@code.launchpad.net

Commit message

- Avoid TypeError when fetching credentials in the Gtk OverviewPanel
   (LP: #927743).
- Run the whole test suite with a single command (LP: #927770).
- Do proper cleanup when dealing with UIs (LP: #925617).

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~nataliabidart/ubuntuone-control-panel/gicrazyness into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***
The Python package providing the requested reactor is not installed. You can find it here: http://twistedmatrix.com/trac/ticket/4558

Traceback (most recent call last):
  File "/usr/bin/u1trial", line 325, in <module>
    main()
  File "/usr/bin/u1trial", line 298, in main
    reactor.install(options=config)
  File "/usr/lib/python2.7/dist-packages/ubuntuone-dev-tools/ubuntuone/devtools/reactors/gi.py", line 27, in install
    glibreactor = __import__(reactor_name, None, None, [''])
ImportError: No module named gireactor

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~nataliabidart/ubuntuone-control-panel/gicrazyness into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***

Traceback (most recent call last):
  File "/usr/bin/u1trial", line 325, in <module>
    main()
  File "/usr/bin/u1trial", line 305, in main
    suite = trial_runner.get_suite(config)
  File "/usr/bin/u1trial", line 184, in get_suite
    config['ignore-paths']))
  File "/usr/bin/u1trial", line 168, in _collect_tests
    module_suite = self._load_unittest(filepath)
  File "/usr/bin/u1trial", line 108, in _load_unittest
    module = __import__(modpath, None, None, [""])
  File "/home/tarmac/cache/ubuntuone-control-panel/trunk/ubuntuone/controlpanel/tests/__init__.py", line 28, in <module>
    from ubuntuone.controlpanel.backend import (
  File "/home/tarmac/cache/ubuntuone-control-panel/trunk/ubuntuone/controlpanel/backend.py", line 31, in <module>
    from ubuntuone.platform import is_link
  File "/usr/lib/python2.7/dist-packages/ubuntuone-client/ubuntuone/platform/__init__.py", line 31, in <module>
    from ubuntuone.platform import linux
  File "/usr/lib/python2.7/dist-packages/ubuntuone-client/ubuntuone/platform/linux/__init__.py", line 24, in <module>
    from ubuntuone.platform.linux.os_helper import (
  File "/usr/lib/python2.7/dist-packages/ubuntuone-client/ubuntuone/platform/linux/os_helper.py", line 33, in <module>
    import gio
ImportError: No module named gio

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run-tests'
2--- run-tests 2012-01-18 17:40:33 +0000
3+++ run-tests 2012-02-06 21:07:20 +0000
4@@ -18,17 +18,11 @@
5
6 QT_TESTS_PATH=ubuntuone/controlpanel/gui/qt/tests
7 GTK_TESTS_PATH=ubuntuone/controlpanel/gui/gtk/tests
8+DBUS_TESTS_PATH=ubuntuone/controlpanel/dbustests
9 WINDOWS_TESTS=test_windows.py
10
11 set -e
12
13-if [ "$1" == "-qt" ]; then
14- USE_QT=1
15- shift
16-else
17- USE_QT=0
18-fi
19-
20 if [ $# -ne 0 ]; then
21 # run specific module given by the caller
22 MODULE="$@"
23@@ -45,16 +39,27 @@
24 echo "Please install the 'pep8' package."
25 fi
26 }
27-
28 unset GTK_MODULES
29
30+XVFB_CMDLINE=""
31+XVFB=$(which xvfb-run)
32+if [ $XVFB ]; then
33+ XVFB_CMDLINE="$XVFB -a"
34+fi
35+
36+echo "*** Running test suite for ""$MODULE"" ***"
37+u1trial --reactor=gi -p "$DBUS_TESTS_PATH, $QT_TESTS_PATH, $GTK_TESTS_PATH" -i "$WINDOWS_TESTS" "$MODULE"
38+
39+echo "*** Running DBus test suite ***"
40+u1trial --reactor=glib "$DBUS_TESTS_PATH"
41+
42+echo "*** Running GTK test suite ***"
43+$XVFB_CMDLINE u1trial --reactor=glib "$GTK_TESTS_PATH"
44+
45+echo "*** Running QT test suite for ""$MODULE"" ***"
46 ./setup.py build
47-echo "Running test suite for ""$MODULE"
48-if [ "$USE_QT" -eq 0 ]; then
49- `which xvfb-run` u1trial --ignore-paths "$QT_TESTS_PATH" -i "$WINDOWS_TESTS" "$MODULE"
50-else
51- `which xvfb-run` u1trial --ignore-paths "$GTK_TESTS_PATH" -i "$WINDOWS_TESTS" --reactor=qt4 --gui "$MODULE"
52-fi
53-style_check
54+$XVFB_CMDLINE u1trial -p "$GTK_TESTS_PATH" -i "$WINDOWS_TESTS" --reactor=qt4 --gui "$MODULE"
55 rm -rf _trial_temp
56 rm -rf build
57+
58+style_check
59
60=== modified file 'ubuntuone/controlpanel/gui/gtk/gui.py'
61--- ubuntuone/controlpanel/gui/gtk/gui.py 2012-01-23 20:15:09 +0000
62+++ ubuntuone/controlpanel/gui/gtk/gui.py 2012-02-06 21:07:20 +0000
63@@ -178,6 +178,9 @@
64 label.set_markup(WARNING_MARKUP % message)
65 label.show()
66
67+ def destroy(self):
68+ """Cleanup."""
69+
70
71 class UbuntuOneBin(gtk.VBox):
72 """A Ubuntu One bin."""
73@@ -248,7 +251,7 @@
74
75 __gsignals__ = {
76 'credentials-found': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
77- (gobject.TYPE_BOOLEAN, gobject.TYPE_PYOBJECT)),
78+ (gobject.TYPE_BOOLEAN,)),
79 }
80
81 def __init__(self, main_window):
82@@ -345,7 +348,7 @@
83 def on_credentials_found(self, credentials):
84 """Credentials backend notifies of credentials found."""
85 self.set_property('greyed', False)
86- self.emit('credentials-found', self._credentials_are_new, credentials)
87+ self.emit('credentials-found', self._credentials_are_new)
88
89 @log_call(logger.info)
90 def on_credentials_not_found(self):
91@@ -1568,8 +1571,7 @@
92 """Show the overview panel."""
93 self.set_current_page(0)
94
95- def on_show_management_panel(self, widget=None,
96- credentials_are_new=False, token=None):
97+ def on_show_management_panel(self, widget=None, credentials_are_new=False):
98 """Show the notebook (main panel)."""
99 if self.get_current_page() == 0:
100 self.management.load()
101
102=== modified file 'ubuntuone/controlpanel/gui/gtk/tests/__init__.py'
103--- ubuntuone/controlpanel/gui/gtk/tests/__init__.py 2011-10-24 21:48:27 +0000
104+++ ubuntuone/controlpanel/gui/gtk/tests/__init__.py 2012-02-06 21:07:20 +0000
105@@ -202,21 +202,12 @@
106
107 if self.klass is not None:
108 self.ui = self.klass(**self.kwargs)
109+ self.addCleanup(self.ui.destroy)
110
111 self.memento = MementoHandler()
112 self.memento.setLevel(logging.DEBUG)
113 gui.logger.addHandler(self.memento)
114
115- @defer.inlineCallbacks
116- def tearDown(self):
117- try:
118- self.ui.hide()
119- del self.ui
120- self.ui = None
121- except AttributeError:
122- pass
123- yield super(BaseTestCase, self).tearDown()
124-
125 def assert_image_equal(self, image, filename):
126 """Check that expected and actual represent the same image."""
127 pb = gui.gtk.gdk.pixbuf_new_from_file(gui.get_data_file(filename))
128
129=== modified file 'ubuntuone/controlpanel/gui/gtk/tests/test_gui_basic.py'
130--- ubuntuone/controlpanel/gui/gtk/tests/test_gui_basic.py 2011-11-21 13:32:44 +0000
131+++ ubuntuone/controlpanel/gui/gtk/tests/test_gui_basic.py 2012-02-06 21:07:20 +0000
132@@ -278,7 +278,7 @@
133
134 """
135 self.patch(self.ui.management, 'load', self._set_called)
136- self.ui.overview.emit('credentials-found', False, object())
137+ self.ui.overview.emit('credentials-found', False)
138
139 self.assert_current_tab_correct(self.ui.management)
140 self.assertEqual(self.ui.management.notebook.get_current_page(),
141@@ -291,8 +291,7 @@
142 If first signal parameter is True, visible tab should be services.
143
144 """
145- a_token = object()
146- self.ui.overview.emit('credentials-found', True, a_token)
147+ self.ui.overview.emit('credentials-found', True)
148
149 self.assert_current_tab_correct(self.ui.management)
150 self.assertEqual(self.ui.management.notebook.get_current_page(),
151@@ -301,19 +300,19 @@
152 def test_credentials_found_connects_syncdaemon(self):
153 """On 'credentials-found' signal, ask syncdaemon to connect."""
154 # credentials are new
155- self.ui.overview.emit('credentials-found', True, object())
156+ self.ui.overview.emit('credentials-found', True)
157 self.assert_backend_called('connect_files')
158
159 def test_local_device_removed_shows_overview_panel(self):
160 """On 'local-device-removed' signal, the overview panel is shown."""
161- self.ui.overview.emit('credentials-found', True, object())
162+ self.ui.overview.emit('credentials-found', True)
163 self.ui.management.emit('local-device-removed')
164
165 self.assert_current_tab_correct(self.ui.overview)
166
167 def test_unauthorized_shows_overview_panel(self):
168 """On 'unauthorized' signal, the overview panel is shown."""
169- self.ui.overview.emit('credentials-found', True, object())
170+ self.ui.overview.emit('credentials-found', True)
171 self.ui.management.emit('unauthorized')
172
173 self.assert_current_tab_correct(self.ui.overview)
174@@ -628,7 +627,7 @@
175
176 self.assertFalse(self.ui.get_property('greyed'), 'Must not be greyed.')
177 # assume credentials were in local keyring
178- self.assertEqual(self._called, ((self.ui, False, TOKEN), {}))
179+ self.assertEqual(self._called, ((self.ui, False), {}))
180
181 def test_on_credentials_found_when_creds_are_not_new(self):
182 """Callback 'on_credentials_found' distinguish if creds are new."""
183@@ -641,7 +640,7 @@
184
185 self.assertFalse(self.ui.get_property('greyed'), 'Must not be greyed.')
186 # assume credentials were not in local keyring
187- self.assertEqual(self._called, ((self.ui, True, TOKEN), {}))
188+ self.assertEqual(self._called, ((self.ui, True), {}))
189
190 def test_on_credentials_not_found(self):
191 """Callback 'on_credentials_not_found' is correct."""
192
193=== modified file 'ubuntuone/controlpanel/logger.py'
194--- ubuntuone/controlpanel/logger.py 2011-08-30 16:10:36 +0000
195+++ ubuntuone/controlpanel/logger.py 2012-02-06 21:07:20 +0000
196@@ -34,7 +34,7 @@
197 LOG_LEVEL = logging.DEBUG
198 else:
199 # Only log this level and above
200- LOG_LEVEL = logging.DEBUG # before final release, switch to INFO
201+ LOG_LEVEL = logging.INFO
202
203 FILE_NAME = os.path.join(ubuntuone_log_dir, 'controlpanel.log')
204 MAIN_HANDLER = RotatingFileHandler(FILE_NAME,
205@@ -53,7 +53,7 @@
206 logger = logging.getLogger('ubuntuone.controlpanel.%s' % log_domain)
207 logger.setLevel(LOG_LEVEL)
208 logger.addHandler(MAIN_HANDLER)
209- if os.environ.get('DEBUG'):
210+ if os.environ.get('U1_DEBUG'):
211 debug_handler = logging.StreamHandler(sys.stderr)
212 debug_handler.setFormatter(basic_formatter)
213 logger.addHandler(debug_handler)

Subscribers

People subscribed via source and target branches