Merge lp:~mvo/software-center/lp971776 into lp:software-center

Proposed by Michael Vogt
Status: Superseded
Proposed branch: lp:~mvo/software-center/lp971776
Merge into: lp:software-center
Diff against target: 168 lines (+47/-22) (has conflicts)
5 files modified
debian/changelog (+5/-1)
softwarecenter/ui/gtk3/models/appstore2.py (+17/-12)
test/gtk3/test_appstore2.py (+16/-9)
test/gtk3/test_catview.py (+8/-0)
test/test_package_info.py (+1/-0)
Text conflict in debian/changelog
Text conflict in test/gtk3/test_catview.py
To merge this branch: bzr merge lp:~mvo/software-center/lp971776
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+108687@code.launchpad.net

This proposal has been superseded by a proposal from 2012-06-05.

Description of the change

Fix crash when a image downloaded is invalid for whatever reason (network issues, proxy issues, pay-wall in between). This is the top #5 bug on the software-center errors.ubuntu.com subpage.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-06-01 19:14:37 +0000
3+++ debian/changelog 2012-06-05 07:22:19 +0000
4@@ -1,3 +1,4 @@
5+<<<<<<< TREE
6 software-center (5.3.0) quantal; urgency=low
7
8 [ Robert Roth ]
9@@ -38,6 +39,9 @@
10 -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 01 Jun 2012 19:54:38 +0200
11
12 software-center (5.2.3) UNRELEASEDprecise-proposed; urgency=low
13+=======
14+software-center (5.2.3) precise-proposed; urgency=low
15+>>>>>>> MERGE-SOURCE
16
17 [ Robert Roth ]
18 * lp:~evfool/software-center/lp987801:
19@@ -98,7 +102,7 @@
20 - Filtered out those exhibits that do not their packages available
21 in the db (LP: #986563)
22
23- -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 31 May 2012 10:07:45 +0200
24+ -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 04 Jun 2012 08:53:25 +0200
25
26 software-center (5.2.2.2) precise-proposed; urgency=low
27
28
29=== modified file 'softwarecenter/ui/gtk3/models/appstore2.py'
30--- softwarecenter/ui/gtk3/models/appstore2.py 2012-05-22 14:36:03 +0000
31+++ softwarecenter/ui/gtk3/models/appstore2.py 2012-06-05 07:22:19 +0000
32@@ -121,27 +121,32 @@
33 else:
34 self.icon_cache = {}
35
36+ def _on_image_download_complete(self, downloader, image_file_path, pkgname):
37+ LOG.debug("download for '%s' complete" % image_file_path)
38+ try:
39+ pb = GdkPixbuf.Pixbuf.new_from_file_at_size(image_file_path,
40+ self.icon_size,
41+ self.icon_size)
42+ except GObject.GError as e:
43+ LOG.warn("Failed to get image file for '%s' (%s)",
44+ image_file_path, e)
45+ return
46+ # replace the icon in the icon_cache now that we've got the real
47+ # one
48+ icon_file = split_icon_ext(os.path.basename(image_file_path))
49+ self.icon_cache[icon_file] = pb
50+ self.emit("needs-refresh", pkgname)
51+
52 def _download_icon_and_show_when_ready(self, url, pkgname, icon_file_name):
53 LOG.debug("did not find the icon locally, must download %s" %
54 icon_file_name)
55
56- def on_image_download_complete(downloader, image_file_path, pkgname):
57- LOG.debug("download for '%s' complete" % image_file_path)
58- pb = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_file_path,
59- self.icon_size,
60- self.icon_size)
61- # replace the icon in the icon_cache now that we've got the real
62- # one
63- icon_file = split_icon_ext(os.path.basename(image_file_path))
64- self.icon_cache[icon_file] = pb
65- self.emit("needs-refresh", pkgname)
66-
67 if url is not None:
68 icon_file_path = os.path.join(SOFTWARE_CENTER_ICON_CACHE_DIR,
69 icon_file_name)
70 image_downloader = SimpleFileDownloader()
71 image_downloader.connect('file-download-complete',
72- on_image_download_complete, pkgname)
73+ self._on_image_download_complete, pkgname)
74 image_downloader.download_file(url, icon_file_path)
75
76 @property
77
78=== modified file 'test/gtk3/test_appstore2.py'
79--- test/gtk3/test_appstore2.py 2012-05-18 05:47:10 +0000
80+++ test/gtk3/test_appstore2.py 2012-06-05 07:22:19 +0000
81@@ -4,7 +4,7 @@
82 import xapian
83
84 from gi.repository import Gtk
85-from mock import patch
86+from mock import Mock, patch
87
88 from testutils import setup_test_env
89 setup_test_env()
90@@ -16,13 +16,14 @@
91 get_test_gtk3_icon_cache,
92 )
93
94-class TestAppstore(unittest.TestCase):
95+class AppStoreTestCase(unittest.TestCase):
96 """ test the appstore """
97
98- def setUp(self):
99- self.cache = get_test_pkg_info()
100- self.icons = get_test_gtk3_icon_cache()
101- self.db = get_test_db()
102+ @classmethod
103+ def setUpClass(cls):
104+ cls.cache = get_test_pkg_info()
105+ cls.icons = get_test_gtk3_icon_cache()
106+ cls.db = get_test_db()
107
108 def test_lp872760(self):
109 def monkey_(s):
110@@ -68,9 +69,15 @@
111 # ensure clear works
112 model.clear()
113 self.assertEqual(model.current_matches, None)
114-
115+
116+ def test_lp971776(self):
117+ """ ensure that refresh is not called for invalid image files """
118+ model = AppListStore(self.db, self.cache, self.icons)
119+ model.emit = Mock()
120+ model._on_image_download_complete(None, "xxx", "software-center")
121+ self.assertFalse(model.emit.called)
122
123 if __name__ == "__main__":
124- import logging
125- logging.basicConfig(level=logging.DEBUG)
126+ #import logging
127+ #logging.basicConfig(level=logging.DEBUG)
128 unittest.main()
129
130=== modified file 'test/gtk3/test_catview.py'
131--- test/gtk3/test_catview.py 2012-06-01 19:14:37 +0000
132+++ test/gtk3/test_catview.py 2012-06-05 07:22:19 +0000
133@@ -115,7 +115,11 @@
134 class RecommendationsTestCase(CatViewBaseTestCase):
135 """The test suite for the recommendations ."""
136
137+<<<<<<< TREE
138 # FIXME: reenable
139+=======
140+ @unittest.skip("Disabled because of race condition in test")
141+>>>>>>> MERGE-SOURCE
142 @patch('softwarecenter.backend.recagent.RecommenderAgent.is_opted_in')
143 def disabled_test_recommended_for_you_opt_in_display(
144 self, mock_get_recommender_opted_in):
145@@ -128,7 +132,11 @@
146 FramedHeaderBox.CONTENT)
147 self.assertTrue(self.rec_panel.opt_in_vbox.get_property("visible"))
148
149+<<<<<<< TREE
150 # FIXME: reenable
151+=======
152+ @unittest.skip("Disabled because of race condition in test")
153+>>>>>>> MERGE-SOURCE
154 # patch out the agent query method to avoid making the actual server call
155 @patch('softwarecenter.backend.recagent.RecommenderAgent.is_opted_in')
156 @patch('softwarecenter.backend.recagent.RecommenderAgent'
157
158=== modified file 'test/test_package_info.py'
159--- test/test_package_info.py 2012-01-16 14:42:49 +0000
160+++ test/test_package_info.py 2012-06-05 07:22:19 +0000
161@@ -65,6 +65,7 @@
162 pkginfo = self.pkginfo
163 self.assertTrue(len(pkginfo.get_addons("firefox")) > 0)
164
165+ @unittest.skip("disabled due to invalid fixture data")
166 def test_removal(self):
167 pkginfo = self.pkginfo
168 pkg = pkginfo['coreutils']

Subscribers

People subscribed via source and target branches