Merge lp:~dobey/ubuntuone-installer/qt-foo into lp:ubuntuone-installer

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 23
Merged at revision: 25
Proposed branch: lp:~dobey/ubuntuone-installer/qt-foo
Merge into: lp:ubuntuone-installer
Diff against target: 216 lines (+110/-26)
6 files modified
bin/ubuntuone-installer (+7/-17)
run-tests (+2/-3)
ubuntuone/installer/__init__.py (+33/-0)
ubuntuone/installer/gui.py (+7/-5)
ubuntuone/installer/tests/test_gui.py (+1/-1)
ubuntuone/installer/tests/test_installer.py (+60/-0)
To merge this branch: bzr merge lp:~dobey/ubuntuone-installer/qt-foo
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+93603@code.launchpad.net

Commit message

Use the gireactor to run tests now
Add constants for the control panel and music store packages and command
Install and run the qt control panel now
Install the rhythmbox extension now, rather than the banshee one

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :
Download full text (7.0 KiB)

I'm getting these when running the tests, any idea what's going on?

ubuntuone.devtools.testcases.dbus
  DBusTestCase
    runTest ... [OK]
ubuntuone.installer.tests.test_gui
  GUITestCase
    test_initial_page ... [OK]
    test_page_switched ... Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/defer/__init__.py", line 475, in _inline_callbacks
    result = gen.send(result)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/client.py", line 1613, in _run_transaction_helper
    daemon = get_aptdaemon(self.bus)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/client.py", line 1687, in get_aptdaemon
    False),
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.debian.apt was not provided by any .service files
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/defer/__init__.py", line 475, in _inline_callbacks
    result = gen.send(result)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/client.py", line 1613, in _run_transaction_helper
    daemon = get_aptdaemon(self.bus)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/client.py", line 1687, in get_aptdaemon
    False),
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.debian.apt was not provided by any .service files
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.debian.apt was not provided by any .service files
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/defer/__init__.py", line 473, in _inline_callbacks
    result = gen.throw(result.type, result.value, result.traceback)
  File "/home/nessita/canonical/installer/review_qt-foo/ubuntuone/installer/gui.py", line 377, in __update_cache
    sources_list='ubuntuone-stable-ppa.list')
dbus.exce...

Read more...

review: Needs Information
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Is worth noting that all the errors above are also present in trunk. Since the code itself looks good, can you please create a big for the DBus errors? I'm approving this branch.

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (11.6 KiB)

The attempt to merge lp:~dobey/ubuntuone-installer/qt-foo into lp:ubuntuone-installer failed. Below is the output from the failed tests.

ubuntuone.devtools.testcases.dbus
  DBusTestCase
    runTest ... [OK]
ubuntuone.installer.tests.test_gui
  GUITestCase
    test_initial_page ... [OK]
    test_page_switched ... Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/defer/__init__.py", line 475, in _inline_callbacks
    result = gen.send(result)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/client.py", line 1613, in _run_transaction_helper
    daemon = get_aptdaemon(self.bus)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/client.py", line 1687, in get_aptdaemon
    False),
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.debian.apt was not provided by any .service files
OSError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_u1trial.1001.crash'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/defer/__init__.py", line 475, in _inline_callbacks
    result = gen.send(result)
  File "/home/tarmac/cache/ubuntuone-installer/trunk/ubuntuone/installer/gui.py", line 377, in __update_cache
    sources_list='ubuntuone-stable-ppa.list')
  File "/usr/lib/python2.7/dist-packages/defer/utils.py", line 105, in _deferable
    func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/errors.py", line 183, in _convert_dbus_exception
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/client.py", line 1489, in update_cache
    wait, reply_handler, error_handler)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/client.py", line 1576, in _run_transaction
    error_handler(error)
  File "/usr/lib/python2.7/dist-packages/aptdaemon/errors.py", line 181, in <lambda>
    lambda err: error_handler(get_native_exception(err))
  File "/usr/lib/python2.7/dist-packages/defer/utils.py", line 104, in <lambda>
    kwargs["error_handler"] = lambda err: on_error(err, deferred)
  File "/usr/lib/python2.7/dist-packages/defer/utils.py", line 87, in on_error
    deferred.errback(DeferredException(error))
  File "/usr/lib/python2.7/dist-packages/defer/__init__.py", line 351, in errback
    self._next()
  File "/usr/lib/python2.7/dist-packages/defer/__init__.py", line 407, in _next
    self.result.traceback)
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 126, in apport_excepthoo...

lp:~dobey/ubuntuone-installer/qt-foo updated
23. By dobey

Don't need to rm .coverage without doing the coverage report any more

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ubuntuone-installer'
2--- bin/ubuntuone-installer 2011-09-14 20:12:58 +0000
3+++ bin/ubuntuone-installer 2012-02-20 17:57:17 +0000
4@@ -1,7 +1,7 @@
5 #!/usr/bin/python
6 # -*- coding: utf-8 -*-
7 #
8-# Copyright 2011 Canonical Ltd.
9+# Copyright 2011-2012 Canonical Ltd.
10 #
11 # This program is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License version 3, as published
13@@ -16,24 +16,14 @@
14 # with this program. If not, see <http://www.gnu.org/licenses/>.
15 """The main script for the Ubuntu One Installer."""
16
17-import apt
18-import os
19-
20 from gi.repository import Gtk, GLib
21-
22-
23-def is_installed(package):
24- """Check if things are installed already."""
25- try:
26- cache = apt.Cache()
27- return package in cache and cache[package].is_installed
28- except SystemError:
29- return os.path.exists('/usr/bin/ubuntuone-control-panel-gtk')
30-
31-
32+from ubuntuone.installer import (is_installed,
33+ CONTROL_PANEL_COMMAND, CONTROL_PANEL_PACKAGE)
34+
35+
36 if __name__ == "__main__":
37- if is_installed('ubuntuone-control-panel-gtk'):
38- GLib.spawn_command_line_async('ubuntuone-control-panel-gtk')
39+ if is_installed(CONTROL_PANEL_PACKAGE):
40+ GLib.spawn_command_line_async(CONTROL_PANEL_COMMAND)
41 else:
42 from ubuntuone.installer.gui import Window
43 dialog = Window()
44
45=== modified file 'run-tests'
46--- run-tests 2011-07-29 17:30:44 +0000
47+++ run-tests 2012-02-20 17:57:17 +0000
48@@ -18,9 +18,8 @@
49
50 unset GTK_MODULES
51
52-`which xvfb-run` u1trial -c ubuntuone
53+`which xvfb-run` u1trial -r gi ubuntuone
54 USE_PYFLAKES=1 u1lint
55-pep8 --repeat .
56+pep8 --repeat . bin/*
57 rm -rf _trial_temp
58-rm .coverage
59
60
61=== modified file 'ubuntuone/installer/__init__.py'
62--- ubuntuone/installer/__init__.py 2011-07-29 14:31:29 +0000
63+++ ubuntuone/installer/__init__.py 2012-02-20 17:57:17 +0000
64@@ -1,1 +1,34 @@
65+# -*- coding: utf-8 -*-
66+#
67+# Copyright 2012 Canonical Ltd.
68+#
69+# This program is free software: you can redistribute it and/or modify it
70+# under the terms of the GNU General Public License version 3, as published
71+# by the Free Software Foundation.
72+#
73+# This program is distributed in the hope that it will be useful, but
74+# WITHOUT ANY WARRANTY; without even the implied warranties of
75+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
76+# PURPOSE. See the GNU General Public License for more details.
77+#
78+# You should have received a copy of the GNU General Public License along
79+# with this program. If not, see <http://www.gnu.org/licenses/>.
80 """Ubuntu One Installer package."""
81+
82+import apt
83+
84+from gi.repository import GLib
85+
86+CONTROL_PANEL_COMMAND = 'ubuntuone-control-panel-qt'
87+CONTROL_PANEL_PACKAGE = 'ubuntuone-control-panel-qt'
88+
89+MUSIC_STORE_PACKAGE = 'rhythmbox-ubuntuone'
90+
91+
92+def is_installed(package, command='false'):
93+ """Check if things are installed already."""
94+ try:
95+ cache = apt.Cache()
96+ return package in cache and cache[package].is_installed
97+ except SystemError:
98+ return GLib.find_program_in_path(command) is not None
99
100=== modified file 'ubuntuone/installer/gui.py'
101--- ubuntuone/installer/gui.py 2011-09-14 19:50:24 +0000
102+++ ubuntuone/installer/gui.py 2012-02-20 17:57:17 +0000
103@@ -1,6 +1,6 @@
104 # -*- coding: utf-8 -*-
105 #
106-# Copyright 2011 Canonical Ltd.
107+# Copyright 2011-2012 Canonical Ltd.
108 #
109 # This program is free software: you can redistribute it and/or modify it
110 # under the terms of the GNU General Public License version 3, as published
111@@ -21,6 +21,9 @@
112 import os
113
114 from gi.repository import Gtk, GObject, GLib, Gdk, Pango
115+from ubuntuone.installer import (CONTROL_PANEL_COMMAND,
116+ CONTROL_PANEL_PACKAGE,
117+ MUSIC_STORE_PACKAGE)
118
119 # Some shenanigans to deal with pyflakes complaining
120 inline_callbacks = None
121@@ -354,14 +357,13 @@
122 self.__apt_progress.set_fraction(0.0)
123
124 def finished(*args, **kwargs):
125- GLib.spawn_command_line_async('ubuntuone-control-panel-gtk')
126+ GLib.spawn_command_line_async(CONTROL_PANEL_COMMAND)
127 Gtk.main_quit()
128
129 transaction = yield self.client.install_packages(
130- package_names=['banshee-extension-ubuntuonemusicstore',
131+ package_names=[MUSIC_STORE_PACKAGE,
132 'ubuntuone-client-gnome',
133- 'ubuntuone-control-panel-gtk',
134- 'ubuntuone-couch',
135+ CONTROL_PANEL_PACKAGE,
136 ])
137 transaction.connect('finished', finished)
138 self.__apt_progress.set_transaction(transaction)
139
140=== modified file 'ubuntuone/installer/tests/test_gui.py'
141--- ubuntuone/installer/tests/test_gui.py 2011-08-08 14:21:10 +0000
142+++ ubuntuone/installer/tests/test_gui.py 2012-02-20 17:57:17 +0000
143@@ -17,7 +17,7 @@
144
145 from gi.repository import Gtk
146 from twisted.internet.defer import inlineCallbacks
147-from ubuntuone.devtools.testcase import DBusTestCase
148+from ubuntuone.devtools.testcases.dbus import DBusTestCase
149 from ubuntuone.installer import gui
150
151
152
153=== added file 'ubuntuone/installer/tests/test_installer.py'
154--- ubuntuone/installer/tests/test_installer.py 1970-01-01 00:00:00 +0000
155+++ ubuntuone/installer/tests/test_installer.py 2012-02-20 17:57:17 +0000
156@@ -0,0 +1,60 @@
157+# -*- coding: utf-8 -*-
158+#
159+# Copyright 2012 Canonical Ltd.
160+#
161+# This program is free software: you can redistribute it and/or modify it
162+# under the terms of the GNU General Public License version 3, as published
163+# by the Free Software Foundation.
164+#
165+# This program is distributed in the hope that it will be useful, but
166+# WITHOUT ANY WARRANTY; without even the implied warranties of
167+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
168+# PURPOSE. See the GNU General Public License for more details.
169+#
170+# You should have received a copy of the GNU General Public License along
171+# with this program. If not, see <http://www.gnu.org/licenses/>.
172+"""Tests for basic logic of the Ubuntu One Installer."""
173+
174+import apt
175+
176+from ubuntuone.devtools.testcases import BaseTestCase
177+from ubuntuone import installer
178+
179+
180+class FakeCacheEntry(object):
181+ """Fake cache object."""
182+
183+ def __init__(self, is_installed=False):
184+ super(FakeCacheEntry, self).__init__()
185+ self.is_installed = is_installed
186+
187+
188+class InstallerTestCase(BaseTestCase):
189+ """Main logic tests."""
190+
191+ def test_is_installed_true(self):
192+ """Test is_installed does the right thing when true."""
193+ self.patch(apt, 'Cache', lambda: {'foo': FakeCacheEntry(True)})
194+ self.assertTrue(installer.is_installed('foo'))
195+
196+ def test_is_installed_false(self):
197+ """Test is_installed does the right thing when false."""
198+ self.patch(apt, 'Cache', lambda: {'foo': FakeCacheEntry()})
199+ self.assertFalse(installer.is_installed('foo'))
200+
201+ def test_is_installed_systemerror_false(self):
202+ """Test is_installed does the right thing if SystemError is raised."""
203+ def _raise_system_error():
204+ raise SystemError('Testing.')
205+
206+ self.patch(apt, 'Cache', _raise_system_error)
207+ self.assertRaises(TypeError, installer.is_installed, 'foo', None)
208+
209+ def test_is_installed_systemerror_true(self):
210+ """Test is_installed does the right thing if SystemError is raised,
211+ and the command is found."""
212+ def _raise_system_error():
213+ raise SystemError('Testing.')
214+
215+ self.patch(apt, 'Cache', _raise_system_error)
216+ self.assertTrue(installer.is_installed('foo', 'python'))

Subscribers

People subscribed via source and target branches

to all changes: