Merge lp:~nataliabidart/magicicada-gui/use-initial-on-gui into lp:magicicada-gui

Proposed by Natalia Bidart
Status: Merged
Merged at revision: 73
Proposed branch: lp:~nataliabidart/magicicada-gui/use-initial-on-gui
Merge into: lp:magicicada-gui
Diff against target: 1043 lines (+222/-218)
8 files modified
magicicada/__init__.py (+17/-18)
magicicada/logger.py (+5/-0)
magicicada/syncdaemon.py (+4/-0)
magicicada/tests/test_dbusiface.py (+29/-29)
magicicada/tests/test_magicicada.py (+29/-38)
magicicada/tests/test_syncdaemon.py (+13/-6)
pylintrc (+116/-124)
test (+9/-3)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-gui/use-initial-on-gui
Reviewer Review Type Date Requested Status
Facundo Batista Approve
Review via email: mp+35213@code.launchpad.net

Commit message

Volumes and metadata buttons are enabled when initial_data_ready callback is fired (LP: #612194).

To post a comment you must log in.
76. By Natalia Bidart

Improved arguments passed to trial, so we can either pass a
file|package|module|TestCase|testmethod] or nothing to run the whole suite.

77. By Natalia Bidart

Minor tweaks.

Revision history for this message
Facundo Batista (facundo) wrote :

You added options (commented out, but you still added them) to pylintrc that are no longer valid, like "enabled-cat".

Please, fix that.

The rest is fine :)

review: Needs Fixing
78. By Natalia Bidart

Removed {enable,disable}-cat since they are ignored.

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

> You added options (commented out, but you still added them) to pylintrc that
> are no longer valid, like "enabled-cat".
>
> Please, fix that.
>
> The rest is fine :)

Fixed!

Revision history for this message
Facundo Batista (facundo) wrote :

:)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magicicada/__init__.py'
2--- magicicada/__init__.py 2010-08-21 18:54:31 +0000
3+++ magicicada/__init__.py 2010-09-14 21:39:47 +0000
4@@ -31,9 +31,9 @@
5 # this shouldn't crash if not found as it is simply used for bug reporting
6 try:
7 import LaunchpadIntegration
8- launchpad_available = True
9+ LAUNCHPAD_AVAILABLE = True
10 except ImportError:
11- launchpad_available = False
12+ LAUNCHPAD_AVAILABLE = False
13
14 from twisted.internet import gtk2reactor # for gtk-2.0
15 gtk2reactor.install()
16@@ -47,16 +47,11 @@
17 UBUNTU_ONE_ROOT = os.path.expanduser('~/Ubuntu One')
18
19 # set up the logging for all the project
20+# Instance of 'RootLogger' has no 'set_up' member
21+# pylint: disable=E1103
22 logger_helper.set_up()
23 logger = logging.getLogger('magicicada.ui')
24
25-DEBUG = os.getenv('DEBUG')
26-if DEBUG:
27- console = logging.StreamHandler()
28- console.setLevel(logging.DEBUG)
29- logger.addHandler(console)
30-
31-
32 # Instance of 'A' has no 'y' member
33 # pylint: disable=E1101
34
35@@ -81,7 +76,7 @@
36 self.builder = get_builder('gui.glade')
37 self.builder.connect_signals(self)
38
39- if launchpad_available:
40+ if LAUNCHPAD_AVAILABLE:
41 # for more information about LaunchpadIntegration:
42 # wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding
43 helpmenu = self.builder.get_object('helpMenu')
44@@ -132,8 +127,8 @@
45 icon_filename = get_data_file('media', 'logo-016.png')
46 self._icon = gtk.gdk.pixbuf_new_from_file(icon_filename)
47 self.status_icon.set_from_file(icon_filename)
48- for w in self.windows:
49- w.set_icon(self._icon)
50+ for win in self.windows:
51+ win.set_icon(self._icon)
52
53 about_fname = get_data_file('media', 'logo-128.png')
54 self.about_dialog.set_logo(gtk.gdk.pixbuf_new_from_file(about_fname))
55@@ -149,6 +144,7 @@
56 self.sd.content_queue_changed_callback = self.on_content_queue_changed
57 self.sd.meta_queue_changed_callback = self.on_meta_queue_changed
58 self.sd.on_metadata_ready_callback = self.on_metadata_ready
59+ self.sd.on_initial_data_ready_callback = self.on_initial_data_ready
60
61 self.widget_is_visible = lambda w: w.get_property('visible')
62 self.widget_enabled = lambda w: self.widget_is_visible(w) and \
63@@ -222,8 +218,8 @@
64
65 def on_stop_clicked(self, widget, data=None):
66 """Stop syncdaemon."""
67- for v in self.volumes:
68- v.set_sensitive(False)
69+ for volume in self.volumes:
70+ volume.set_sensitive(False)
71 self.metadata.set_sensitive(False)
72
73 if self.widget_enabled(self.disconnect):
74@@ -370,10 +366,6 @@
75 self._activate_indicator(self.is_started)
76 self.connect.set_sensitive(True)
77
78- for v in self.volumes:
79- v.set_sensitive(True)
80- self.metadata.set_sensitive(True)
81-
82 self._update_queues_and_status(self.sd.current_state)
83
84 @log(logger)
85@@ -489,6 +481,13 @@
86 text = '\n'.join('%s: %s' % i for i in metadata.iteritems())
87 dialog.view.get_buffer().set_text(text)
88
89+ @log(logger)
90+ def on_initial_data_ready(self):
91+ """Initial data is now available in syncdaemon."""
92+ for volume in self.volumes:
93+ volume.set_sensitive(True)
94+ self.metadata.set_sensitive(True)
95+
96 # custom
97
98 def _start_loading(self, what):
99
100=== modified file 'magicicada/logger.py'
101--- magicicada/logger.py 2010-08-18 21:17:20 +0000
102+++ magicicada/logger.py 2010-09-14 21:39:47 +0000
103@@ -68,5 +68,10 @@
104 handler.setFormatter(formatter)
105 logger.setLevel(logging.DEBUG)
106
107+ if os.getenv('DEBUG'):
108+ console = logging.StreamHandler()
109+ console.setLevel(logging.DEBUG)
110+ logger.addHandler(console)
111+
112 # hook the exception handler
113 sys.excepthook = exception_handler
114
115=== modified file 'magicicada/syncdaemon.py'
116--- magicicada/syncdaemon.py 2010-09-02 18:23:02 +0000
117+++ magicicada/syncdaemon.py 2010-09-14 21:39:47 +0000
118@@ -274,6 +274,8 @@
119 self._get_mq_data()
120
121 if self._must_poll_mq:
122+ # Module 'twisted.internet.reactor' has no 'callLater' member
123+ # pylint: disable=E1101
124 self._mqcaller = reactor.callLater(self._mq_poll_time,
125 self._check_mq)
126
127@@ -304,4 +306,6 @@
128 raise ValueError("Missing the mandatory cback for get_metadata.")
129
130 d = self.dbus.get_metadata(os.path.realpath(path))
131+ # self.on_metadata_ready_callback is not callable
132+ # pylint: disable=E1102
133 d.addCallback(lambda resp: self.on_metadata_ready_callback(path, resp))
134
135=== modified file 'magicicada/tests/test_dbusiface.py'
136--- magicicada/tests/test_dbusiface.py 2010-08-23 16:48:07 +0000
137+++ magicicada/tests/test_dbusiface.py 2010-09-14 21:39:47 +0000
138@@ -263,13 +263,13 @@
139 self.dbus._on_name_owner_changed("foo", "bar", "baz")
140 self.get_msd_called(None)
141
142- def test_name_owner_changed_yes_syncdaemon_TF(self):
143+ def test_name_owner_changed_yes_syncdaemon_true_false(self):
144 """Test name owner changed callback."""
145 self.dbus._on_name_owner_changed("com.ubuntuone.SyncDaemon", "T", "")
146 rcv, = self.get_msd_called("on_sd_name_owner_changed")
147 self.assertEqual(rcv, False)
148
149- def test_name_owner_changed_yes_syncdaemon_FT(self):
150+ def test_name_owner_changed_yes_syncdaemon_false_true(self):
151 """Test name owner changed callback."""
152 self.dbus._on_name_owner_changed("com.ubuntuone.SyncDaemon", "", "T")
153 rcv, = self.get_msd_called("on_sd_name_owner_changed")
154@@ -371,7 +371,7 @@
155 self.assertEqual(data.node, None)
156
157 @defer.inlineCallbacks
158- def test_GetPublicFiles_old(self):
159+ def test_getpublicfiles_old(self):
160 """Test meta with GetPublicFiles."""
161 cmd = 'GetPublicFiles'
162 self.fake_sdt_response('waiting_metadata', [cmd])
163@@ -383,7 +383,7 @@
164 self.assertEqual(data.node, None)
165
166 @defer.inlineCallbacks
167- def test_AccountInquiry_old(self):
168+ def test_accountinquiry_old(self):
169 """Test meta with AccountInquiry."""
170 cmd = 'AccountInquiry'
171 self.fake_sdt_response('waiting_metadata', [cmd])
172@@ -395,7 +395,7 @@
173 self.assertEqual(data.node, None)
174
175 @defer.inlineCallbacks
176- def test_FreeSpaceInquiry_old(self):
177+ def test_freespaceinquiry_old(self):
178 """Test meta with FreeSpaceInquiry."""
179 cmd = 'FreeSpaceInquiry'
180 self.fake_sdt_response('waiting_metadata', [cmd])
181@@ -407,7 +407,7 @@
182 self.assertEqual(data.node, None)
183
184 @defer.inlineCallbacks
185- def test_ListShares_old(self):
186+ def test_listshares_old(self):
187 """Test meta with ListShares."""
188 cmd = 'ListShares'
189 self.fake_sdt_response('waiting_metadata', [cmd])
190@@ -419,7 +419,7 @@
191 self.assertEqual(data.node, None)
192
193 @defer.inlineCallbacks
194- def test_ListVolumes_old(self):
195+ def test_listvolumes_old(self):
196 """Test meta with ListVolumes."""
197 cmd = 'ListVolumes'
198 self.fake_sdt_response('waiting_metadata', [cmd])
199@@ -431,7 +431,7 @@
200 self.assertEqual(data.node, None)
201
202 @defer.inlineCallbacks
203- def test_Query_old(self):
204+ def test_query_old(self):
205 """Test meta with Query."""
206 cmd = 'Query'
207 self.fake_sdt_response('waiting_metadata', [cmd])
208@@ -443,7 +443,7 @@
209 self.assertEqual(data.node, None)
210
211 @defer.inlineCallbacks
212- def test_ListDir_old(self):
213+ def test_listdir_old(self):
214 """Test meta with ListDir."""
215 cmd = 'ListDir(share_id=a, node_id=b, server_hash=c)'
216 self.fake_sdt_response('waiting_metadata', [cmd])
217@@ -455,7 +455,7 @@
218 self.assertEqual(data.node, 'b')
219
220 @defer.inlineCallbacks
221- def test_MakeDir_old(self):
222+ def test_makedir_old(self):
223 """Test meta with MakeDir."""
224 cmd = 'MakeDir(share_id=a, parent_id=b, name=c, marker=d)'
225 self.fake_sdt_response('waiting_metadata', [cmd])
226@@ -467,7 +467,7 @@
227 self.assertEqual(data.node, None)
228
229 @defer.inlineCallbacks
230- def test_MakeFile_old(self):
231+ def test_makefile_old(self):
232 """Test meta with MakeFile."""
233 cmd = 'MakeFile(share_id=a, parent_id=b, name=c, marker=d)'
234 self.fake_sdt_response('waiting_metadata', [cmd])
235@@ -479,7 +479,7 @@
236 self.assertEqual(data.node, None)
237
238 @defer.inlineCallbacks
239- def test_Unlink_old(self):
240+ def test_unlink_old(self):
241 """Test meta with Unlink."""
242 cmd = 'Unlink(share_id=a, node_id=b, server_hash=c)'
243 self.fake_sdt_response('waiting_metadata', [cmd])
244@@ -491,7 +491,7 @@
245 self.assertEqual(data.node, 'b')
246
247 @defer.inlineCallbacks
248- def test_Move_old(self):
249+ def test_move_old(self):
250 """Test meta with Move."""
251 cmd = 'Move(share_id=a, node_id=b, old_parent_id=c, '\
252 'new_parent_id=d, new_name=e)'
253@@ -504,7 +504,7 @@
254 self.assertEqual(data.node, 'b')
255
256 @defer.inlineCallbacks
257- def test_ChangePublicAccess_old(self):
258+ def test_changepublicaccess_old(self):
259 """Test meta with ChangePublicAccess."""
260 cmd = 'ChangePublicAccess'
261 self.fake_sdt_response('waiting_metadata', [cmd])
262@@ -516,7 +516,7 @@
263 self.assertEqual(data.node, None)
264
265 @defer.inlineCallbacks
266- def test_AnswerShare_old(self):
267+ def test_answershare_old(self):
268 """Test meta with AnswerShare."""
269 cmd = 'AnswerShare'
270 self.fake_sdt_response('waiting_metadata', [cmd])
271@@ -528,7 +528,7 @@
272 self.assertEqual(data.node, None)
273
274 @defer.inlineCallbacks
275- def test_GetPublicFiles_dict(self):
276+ def test_getpublicfiles_dict(self):
277 """Test meta with GetPublicFiles."""
278 cmd = ('GetPublicFiles', {})
279 self.fake_sdt_response('waiting_metadata', [cmd])
280@@ -540,7 +540,7 @@
281 self.assertEqual(data.node, None)
282
283 @defer.inlineCallbacks
284- def test_AccountInquiry_dict(self):
285+ def test_accountinquiry_dict(self):
286 """Test meta with AccountInquiry."""
287 cmd = ('AccountInquiry', {})
288 self.fake_sdt_response('waiting_metadata', [cmd])
289@@ -552,7 +552,7 @@
290 self.assertEqual(data.node, None)
291
292 @defer.inlineCallbacks
293- def test_FreeSpaceInquiry_dict(self):
294+ def test_freespaceinquiry_dict(self):
295 """Test meta with FreeSpaceInquiry."""
296 cmd = ('FreeSpaceInquiry', {})
297 self.fake_sdt_response('waiting_metadata', [cmd])
298@@ -564,7 +564,7 @@
299 self.assertEqual(data.node, None)
300
301 @defer.inlineCallbacks
302- def test_ListShares_dict(self):
303+ def test_listshares_dict(self):
304 """Test meta with ListShares."""
305 cmd = ('ListShares', {})
306 self.fake_sdt_response('waiting_metadata', [cmd])
307@@ -576,7 +576,7 @@
308 self.assertEqual(data.node, None)
309
310 @defer.inlineCallbacks
311- def test_ListVolumes_dict(self):
312+ def test_listvolumes_dict(self):
313 """Test meta with ListVolumes."""
314 cmd = ('ListVolumes', {})
315 self.fake_sdt_response('waiting_metadata', [cmd])
316@@ -588,7 +588,7 @@
317 self.assertEqual(data.node, None)
318
319 @defer.inlineCallbacks
320- def test_Query_dict(self):
321+ def test_query_dict(self):
322 """Test meta with Query."""
323 cmd = ('Query', {})
324 self.fake_sdt_response('waiting_metadata', [cmd])
325@@ -600,7 +600,7 @@
326 self.assertEqual(data.node, None)
327
328 @defer.inlineCallbacks
329- def test_ListDir_dict(self):
330+ def test_listdir_dict(self):
331 """Test meta with ListDir."""
332 cmd = ('ListDir', dict(share_id='a', node_id='b',
333 server_hash='c', path='d'))
334@@ -613,7 +613,7 @@
335 self.assertEqual(data.node, 'b')
336
337 @defer.inlineCallbacks
338- def test_MakeDir_dict(self):
339+ def test_makedir_dict(self):
340 """Test meta with MakeDir."""
341 cmd = ('MakeDir', dict(share_id='a', parent_id='b',
342 name='c', marker='d'))
343@@ -626,7 +626,7 @@
344 self.assertEqual(data.node, None)
345
346 @defer.inlineCallbacks
347- def test_MakeFile_dict(self):
348+ def test_makefile_dict(self):
349 """Test meta with MakeFile."""
350 cmd = ('MakeFile', dict(share_id='a', parent_id='b',
351 name='c', marker='d'))
352@@ -639,7 +639,7 @@
353 self.assertEqual(data.node, None)
354
355 @defer.inlineCallbacks
356- def test_Unlink_dict(self):
357+ def test_unlink_dict(self):
358 """Test meta with Unlink."""
359 cmd = ('Unlink', dict(share_id='a', node_id='b',
360 server_hash='c', path='d'))
361@@ -652,7 +652,7 @@
362 self.assertEqual(data.node, 'b')
363
364 @defer.inlineCallbacks
365- def test_Move_dict(self):
366+ def test_move_dict(self):
367 """Test meta with Move."""
368 cmd = ('Move', dict(share_id='a', node_id='b', old_parent_id='c',
369 new_parent_id='d', new_name='e', path='f'))
370@@ -665,7 +665,7 @@
371 self.assertEqual(data.node, 'b')
372
373 @defer.inlineCallbacks
374- def test_ChangePublicAccess_dict(self):
375+ def test_changepublicaccess_dict(self):
376 """Test meta with ChangePublicAccess."""
377 cmd = ('ChangePublicAccess', {})
378 self.fake_sdt_response('waiting_metadata', [cmd])
379@@ -677,7 +677,7 @@
380 self.assertEqual(data.node, None)
381
382 @defer.inlineCallbacks
383- def test_AnswerShare_dict(self):
384+ def test_answershare_dict(self):
385 """Test meta with AnswerShare."""
386 cmd = ('AnswerShare', {})
387 self.fake_sdt_response('waiting_metadata', [cmd])
388@@ -1052,7 +1052,7 @@
389 self.assertTrue(self.handler.check_info("Received Name Owner changed"))
390 self.assertTrue(self.handler.check_debug("Name Owner data: u'' u'T'"))
391
392- def test_name_owner_changed_yes_syncdaemon_TF(self):
393+ def test_name_owner_changed_yes_syncdaemon_true_false(self):
394 """Test name owner changed callback, SD value bad."""
395 self.dbus._on_name_owner_changed("com.ubuntuone.SyncDaemon", "F", "T")
396 self.assertTrue(self.handler.check_info("Received Name Owner changed"))
397
398=== modified file 'magicicada/tests/test_magicicada.py'
399--- magicicada/tests/test_magicicada.py 2010-08-21 16:58:46 +0000
400+++ magicicada/tests/test_magicicada.py 2010-09-14 21:39:47 +0000
401@@ -101,8 +101,12 @@
402 self.content_queue_changed_callback = NO_OP
403 self.meta_queue_changed_callback = NO_OP
404 self.on_metadata_ready_callback = None # mandatory
405+ self.on_initial_data_ready_callback = NO_OP
406 self.shutdown = NO_OP
407
408+ # Lambda may not be necessary
409+ # pylint: disable=W0108
410+
411 self.start = lambda: setattr(self.current_state, 'is_started', True)
412 self.quit = lambda: setattr(self.current_state, 'is_started', False)
413 self.connect = lambda: setattr(self.current_state,
414@@ -155,30 +159,6 @@
415 else:
416 return TestCase.__getattribute__(self, name)
417
418- if self._failed_test:
419- # no, I'm not raising a bool. pylint: disable=E0702
420- raise self._failed_test
421-
422- def __getattribute__(self, name):
423- """Overwrite the assert methods with safer ones.
424-
425- This way if a test called by gobject in the future fails, it
426- makes the whole test suite fail.
427- """
428- if name.startswith('assert') and hasattr(TestCase, name):
429-
430- def proxy(*args, **kwargs):
431- """Function that will call the real assert."""
432- real_assert = getattr(TestCase, name)
433- try:
434- real_assert(self, *args, **kwargs)
435- except Exception, e:
436- self._failed_test = e
437- raise
438- return proxy
439- else:
440- return TestCase.__getattribute__(self, name)
441-
442 def do_start(self):
443 """Simulate that start fully happened."""
444 self.ui.on_start_clicked(self.ui.start)
445@@ -968,7 +948,7 @@
446 s = super(_MagicicadaUIVolumeTestCase, self)
447 s.assert_widget_availability(self.name, enabled)
448
449- def assert_sort_order_correct(self, column, i, expected_order):
450+ def assert_sort_order_correct(self, column, idx, expected_order):
451 """Check that sort order is correctly set."""
452 msg0 = 'Store sort id must be %r (got %r instead).'
453 msg1 = 'Store sort order must be %r (got %r instead).'
454@@ -977,7 +957,7 @@
455 actual_id, actual_order = self.volume_store.get_sort_column_id()
456
457 # store sort column id and order
458- self.assertEqual(i, actual_id, msg0 % (i, actual_id))
459+ self.assertEqual(idx, actual_id, msg0 % (idx, actual_id))
460 self.assertEqual(expected_order, actual_order,
461 msg1 % (expected_order, actual_order))
462
463@@ -1001,18 +981,27 @@
464 msg % (other_column.get_name(), 'off'))
465
466 @skip_abstract_class
467- def test_volume_are_disabled_until_started(self):
468- """Folders and shares are disabled until online."""
469+ def test_initial_data_ready_callback_connected(self):
470+ """The callback 'on_initial_data_ready' is connected to SD."""
471+ self.assertEqual(self.ui.sd.on_initial_data_ready_callback,
472+ self.ui.on_initial_data_ready,
473+ "on_initial_data_ready should be connected.")
474+
475+ @skip_abstract_class
476+ def test_volume_are_disabled_until_initial_data_ready(self):
477+ """Folders and shares are disabled until data ready."""
478 # disabled at startup
479 self.assert_widget_availability(enabled=False)
480
481- # enabled when started
482- self.do_start()
483+ # enabled when initial data ready
484+ self.ui.on_initial_data_ready()
485 self.assert_widget_availability(enabled=True)
486
487 @skip_abstract_class
488 def test_volume_are_enabled_until_stopped(self):
489 """Folders and shares are enabled until offline."""
490+ self.ui.on_initial_data_ready()
491+
492 self.do_connect()
493 self.assert_widget_availability(enabled=True)
494
495@@ -1130,16 +1119,16 @@
496 @skip_abstract_class
497 def test_volume_sorting(self):
498 """Test volume panel can be re-sorted."""
499- for i, col in enumerate(self.volume_view.get_columns()):
500+ for idx, col in enumerate(self.volume_view.get_columns()):
501 col.clicked() # click on the column
502- self.assert_sort_order_correct(col, i, gtk.SORT_ASCENDING)
503+ self.assert_sort_order_correct(col, idx, gtk.SORT_ASCENDING)
504 self.assert_sort_indicator_correct(col)
505
506 col.clicked() # click on the column, sort order must change
507- self.assert_sort_order_correct(col, i, gtk.SORT_DESCENDING)
508+ self.assert_sort_order_correct(col, idx, gtk.SORT_DESCENDING)
509
510 col.clicked() # click again, sort order must be the first one
511- self.assert_sort_order_correct(col, i, gtk.SORT_ASCENDING)
512+ self.assert_sort_order_correct(col, idx, gtk.SORT_ASCENDING)
513
514
515 class MagicicadaUIFoldersTestCase(_MagicicadaUIVolumeTestCase):
516@@ -1266,17 +1255,19 @@
517 msg = 'buffer content must be %s (got %s instead).'
518 self.assertEqual(actual, expected, msg % (expected, actual))
519
520- def test_metadata_are_disabled_until_started(self):
521- """Metadata button is disabled until online."""
522+ def test_metadata_are_disabled_until_initial_data_ready(self):
523+ """Metadata button is disabled until initial data."""
524 # disabled at startup
525 self.assert_widget_availability(enabled=False)
526
527- # enabled when started
528- self.do_start()
529+ # enabled when initial data ready
530+ self.ui.on_initial_data_ready()
531 self.assert_widget_availability(enabled=True)
532
533 def test_metadata_are_enabled_until_stopped(self):
534 """Metadata button is enabled until offline."""
535+ self.ui.on_initial_data_ready()
536+
537 self.do_connect()
538 self.assert_widget_availability(enabled=True)
539
540
541=== modified file 'magicicada/tests/test_syncdaemon.py'
542--- magicicada/tests/test_syncdaemon.py 2010-09-02 18:23:02 +0000
543+++ magicicada/tests/test_syncdaemon.py 2010-09-14 21:39:47 +0000
544@@ -32,6 +32,9 @@
545 # It's ok to access private data in the test suite
546 # pylint: disable=W0212
547
548+# Lambda may not be necessary
549+# pylint: disable=W0108
550+
551
552 class FakeDBusInterface(object):
553 """Fake DBus Interface, for SD to not use dbus at all during tests."""
554@@ -322,19 +325,19 @@
555 self.sd.on_sd_content_queue_changed()
556 self.assertEqual(called, [['foo']])
557
558- def test_CQ_state_nothing(self):
559+ def test_cq_state_nothing(self):
560 """Check the ContentQueue info, being nothing."""
561 self.sd.dbus.get_content_queue = lambda: defer.succeed([])
562 self.sd.on_sd_content_queue_changed()
563 self.assertEqual(self.sd.content_queue, [])
564
565- def test_CQ_state_one(self):
566+ def test_cq_state_one(self):
567 """Check the ContentQueue info, being one."""
568 self.sd.dbus.get_content_queue = lambda: defer.succeed(['foo'])
569 self.sd.on_sd_content_queue_changed()
570 self.assertEqual(self.sd.content_queue, ['foo'])
571
572- def test_CQ_state_two(self):
573+ def test_cq_state_two(self):
574 """Check the ContentQueue info, two."""
575 self.sd.dbus.get_content_queue = lambda: defer.succeed(['foo', 'bar'])
576 self.sd.on_sd_content_queue_changed()
577@@ -526,6 +529,8 @@
578
579 def test_mq_caller_is_reset_last_time(self):
580 """When MQ is polled last time, the caller should be back to None."""
581+ # Module 'twisted.internet.reactor' has no 'callLater' member
582+ # pylint: disable=E1101
583 self.sd._mqcaller = reactor.callLater(100, lambda: None)
584 self.sd.current_state.set(name='QUEUE_MANAGER',
585 queues='WORKING_ON_CONTENT')
586@@ -550,6 +555,8 @@
587 'WORKING_ON_CONTENT', 'connect')
588
589 # allow time to see if a mistaken call happens
590+ # Module 'twisted.internet.reactor' has no 'callLater' member
591+ # pylint: disable=E1101
592 reactor.callLater(.5, deferred.callback, True)
593 elif len(calls) == 4:
594 pass # last call after state changed
595@@ -566,19 +573,19 @@
596 deferred = defer.Deferred()
597 return deferred
598
599- def test_MQ_state_nothing(self):
600+ def test_mq_state_nothing(self):
601 """Check the MetaQueue info, being nothing."""
602 self.sd.dbus.get_meta_queue = lambda: defer.succeed([])
603 self.sd._check_mq()
604 self.assertEqual(self.sd.meta_queue, [])
605
606- def test_MQ_state_one(self):
607+ def test_mq_state_one(self):
608 """Check the MetaQueue info, being one."""
609 self.sd.dbus.get_meta_queue = lambda: defer.succeed(['foo'])
610 self.sd._check_mq()
611 self.assertEqual(self.sd.meta_queue, ['foo'])
612
613- def test_MQ_state_two(self):
614+ def test_mq_state_two(self):
615 """Check the MetaQueue info, two."""
616 self.sd.dbus.get_meta_queue = lambda: defer.succeed(['foo', 'bar'])
617 self.sd._check_mq()
618
619=== modified file 'pylintrc'
620--- pylintrc 2010-08-23 16:06:20 +0000
621+++ pylintrc 2010-09-14 21:39:47 +0000
622@@ -1,16 +1,20 @@
623 # lint Python modules using external checkers.
624 #
625-# This is the main checker controling the other ones and the reports
626+# This is the main checker controlling the other ones and the reports
627 # generation. It is itself both a raw checker and an astng checker in order
628 # to:
629 # * handle message activation / deactivation at the module level
630-# * handle some basic but necessary stats data (number of classes, methods...)
631+# * handle some basic but necessary stats'data (number of classes, methods...)
632 #
633 [MASTER]
634
635 # Specify a configuration file.
636 #rcfile=
637
638+# Python code to execute, usually for sys.path manipulation such as
639+# pygtk.require().
640+#init-hook=
641+
642 # Profiled execution.
643 profile=no
644
645@@ -21,42 +25,37 @@
646 # Pickle collected data for later comparisons.
647 persistent=no
648
649-# Set the cache size for astng objects.
650-cache-size=500
651-
652 # List of plugins (as comma separated values of python modules names) to load,
653 # usually to register additional checkers.
654 load-plugins=
655
656
657-[COMMANDS]
658-
659-# Display a help message for the given message id and exit. The value may be a
660-# comma separated list of message ids.
661-#help-msg=
662-
663-
664 [MESSAGES CONTROL]
665
666-# Enable only checker(s) with the given id(s). This option conflict with the
667+# Enable only checker(s) with the given id(s). This option conflicts with the
668 # disable-checker option
669 #enable-checker=
670
671-# Enable all checker(s) except those with the given id(s). This option conflict
672-# with the disable-checker option
673-disable-checker=typecheck,design,miscellaneous,similarities
674-
675-# Disable the message(s) with the given id(s) or categories
676-disable=R,I,W0142,W0613,W0108
677+# Enable all checker(s) except those with the given id(s). This option
678+# conflicts with the enable-checker option
679+#disable-checker=
680+
681+# Enable the message(s) with the given id(s).
682+#enable=
683+
684+# Disable the message(s) with the given id(s).
685+# W0142: Used * or ** magic
686+# W0613: Unused argument 'yyy'
687+disable=R,I,W0142,W0613
688
689
690 [REPORTS]
691
692-# set the output format. Available formats are text, parseable, colorized and
693-# html
694+# Set the output format. Available formats are text, parseable, colorized, msvs
695+# (visual studio) and html
696 output-format=colorized
697
698-# Include messages id in output
699+# Include message's id in output
700 include-ids=yes
701
702 # Put messages in a separate file for each module / package specified on the
703@@ -64,12 +63,12 @@
704 # written in a file name "pylint_global.[txt|html]".
705 files-output=no
706
707-# Tells wether to display a full report or only the messages
708+# Tells whether to display a full report or only the messages
709 reports=no
710
711 # Python expression which should return a note less than 10 (10 is the highest
712-# note).You have access to the variables errors warning, statement which
713-# respectivly contain the number of errors / warnings messages and the total
714+# note). You have access to the variables errors warning, statement which
715+# respectively contain the number of errors / warnings messages and the total
716 # number of statements analyzed. This is used by the global evaluation report
717 # (R0004).
718 evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
719@@ -79,53 +78,56 @@
720 comment=no
721
722 # Enable the report(s) with the given id(s).
723-enable-report=
724+#enable-report=
725
726 # Disable the report(s) with the given id(s).
727 #disable-report=
728
729
730+# try to find bugs in the code using type inference
731+#
732+[TYPECHECK]
733+
734+# Tells whether missing members accessed in mixin class should be ignored. A
735+# mixin class is detected if its name ends with "mixin" (case insensitive).
736+ignore-mixin-members=yes
737+
738+# List of classes names for which member attributes should not be checked
739+# (useful for classes with attributes dynamically set).
740+ignored-classes=
741+
742+# When zope mode is activated, add a predefined set of Zope acquired attributes
743+# to generated-members.
744+zope=no
745+
746+# List of members which are set dynamically and missed by pylint inference
747+# system, and so shouldn't trigger E0201 when accessed.
748+generated-members=REQUEST,acl_users,aq_parent
749+
750+
751 # checks for
752 # * unused variables / imports
753 # * undefined variables
754 # * redefinition of variable from builtins or from an outer scope
755-# * use of variable before assigment
756+# * use of variable before assignment
757 #
758 [VARIABLES]
759
760-# Tells wether we should check for unused import in __init__ files.
761+# Tells whether we should check for unused import in __init__ files.
762 init-import=yes
763
764 # A regular expression matching names used for dummy variables (i.e. not used).
765-dummy-variables-rgx=dummy|ignored|cache|__
766+dummy-variables-rgx=_|dummy
767
768 # List of additional names supposed to be defined in builtins. Remember that
769 # you should avoid to define new builtins when possible.
770-additional-builtins=_
771-
772-
773-# try to find bugs in the code using type inference
774-#
775-[TYPECHECK]
776-
777-# Tells wether missing members accessed in mixin class should be ignored. A
778-# mixin class is detected if its name ends with "mixin" (case insensitive).
779-ignore-mixin-members=yes
780-
781-# When zope mode is activated, consider the acquired-members option to ignore
782-# access to some undefined attributes.
783-#zope=yes
784-
785-# List of members which are usually get through zope's acquisition mecanism and
786-# so shouldn't trigger E0201 when accessed (need zope=yes to be considered).
787-# Also uses this to suppress false E1101 errors
788-#acquired-members=REQUEST,acl_users,aq_parent,byName,providedBy,q,union,teamownerID,items,name,destroySelf,count,version,request,context
789+additional-builtins=
790
791
792 # checks for :
793 # * doc strings
794 # * modules / classes / functions / methods / arguments / variables name
795-# * number of arguments, local variables, branchs, returns and statements in
796+# * number of arguments, local variables, branches, returns and statements in
797 # functions, methods
798 # * required module attributes
799 # * dangerous default values as arguments
800@@ -133,7 +135,6 @@
801 # * uses of the global statement
802 #
803 [BASIC]
804-enable-basic=yes
805
806 # Required attributes for module, separated by a comma
807 required-attributes=
808@@ -143,56 +144,86 @@
809 no-docstring-rgx=(__.*__|setUp|tearDown)
810
811 # Regular expression which should only match correct module names
812-module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
813+module-rgx=([a-z_][a-z0-9_]*)$
814
815 # Regular expression which should only match correct module level names
816-const-rgx=([a-z_][a-z0-9_]*|[A-Z_][A-Z0-9_]*)$
817+const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
818
819 # Regular expression which should only match correct class names
820 class-rgx=[A-Z_][a-zA-Z0-9]+$
821
822 # Regular expression which should only match correct function names
823-function-rgx=[a-z_][a-z0-9_]*$
824+function-rgx=[a-z_][a-z0-9_]{2,79}$
825
826 # Regular expression which should only match correct method names
827-method-rgx=[a-z_][a-zA-Z0-9_]*$
828+method-rgx=([a-z_][a-z0-9_]{2,79}$|setUp|tearDown)
829
830 # Regular expression which should only match correct instance attribute names
831-attr-rgx=[a-z_][a-zA-Z0-9_]*$
832+attr-rgx=[a-z_][a-z0-9_]{1,50}$
833
834 # Regular expression which should only match correct argument names
835-argument-rgx=[a-z_][a-zA-Z0-9_]{1,30}$
836+argument-rgx=[a-z_][a-z0-9_]{1,30}$
837
838 # Regular expression which should only match correct variable names
839-# They are normally all lowercase, but when a constant, they are all uppercase.
840-variable-rgx=([a-z_][a-z0-9_]*|[A-Z_][A-Z0-9_]*)$
841+variable-rgx=[a-z_][a-z0-9_]{0,30}$
842
843 # Regular expression which should only match correct list comprehension /
844 # generator expression variable names
845 inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
846
847 # Good variable names which should always be accepted, separated by a comma
848-# Update this to supress warnings about inherrited names (C0103)
849-good-names=_,a,b,c,i,j,k,v,d,f,s,t,l,ex,__
850+good-names=f,logger,_
851
852 # Bad variable names which should always be refused, separated by a comma
853 bad-names=foo,bar,baz,toto,tutu,tata
854
855 # List of builtins function names that should not be used, separated by a comma
856-bad-functions=apply,input,reduce
857+bad-functions=apply,input
858+
859+
860+# checks for sign of poor/misdesign:
861+# * number of methods, attributes, local variables...
862+# * size, complexity of functions, methods
863+#
864+[DESIGN]
865+
866+# Maximum number of arguments for function / method
867+max-args=5
868+
869+# Maximum number of locals for function / method body
870+max-locals=15
871+
872+# Maximum number of return / yield for function / method body
873+max-returns=6
874+
875+# Maximum number of branch for function / method body
876+max-branchs=12
877+
878+# Maximum number of statements in function / method body
879+max-statements=50
880+
881+# Maximum number of parents for a class (see R0901).
882+max-parents=7
883+
884+# Maximum number of attributes for a class (see R0902).
885+max-attributes=7
886+
887+# Minimum number of public methods for a class (see R0903).
888+min-public-methods=2
889+
890+# Maximum number of public methods for a class (see R0904).
891+max-public-methods=20
892
893
894 # checks for :
895 # * methods without self as first argument
896 # * overridden methods signature
897-# * access only to existant members via self
898+# * access only to existent members via self
899 # * attributes not defined in the __init__ method
900 # * supported interfaces implementation
901 # * unreachable code
902 #
903-
904 [CLASSES]
905-enable-classes=yes
906
907 # List of interface methods to ignore, separated by a comma. This is used for
908 # instance to not check methods defines in Zopes Interface base class.
909@@ -209,57 +240,40 @@
910 # * uses of deprecated modules
911 #
912 [IMPORTS]
913-enable-imports=yes
914
915 # Deprecated modules which should not be used, separated by a comma
916-deprecated-modules=regsub,TERMIOS,Bastion,rexec
917+deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
918
919 # Create a graph of every (i.e. internal and external) dependencies in the
920-# given file (report R0402 must not be disabled)
921+# given file (report RP0402 must not be disabled)
922 import-graph=
923
924-# Create a graph of external dependencies in the given file (report R0402 must
925+# Create a graph of external dependencies in the given file (report RP0402 must
926 # not be disabled)
927 ext-import-graph=
928
929-# Create a graph of internal dependencies in the given file (report R0402 must
930+# Create a graph of internal dependencies in the given file (report RP0402 must
931 # not be disabled)
932 int-import-graph=
933
934
935-# checks for sign of poor/misdesign:
936-# * number of methods, attributes, local variables...
937-# * size, complexity of functions, methods
938+# checks for :
939+# * unauthorized constructions
940+# * strict indentation
941+# * line length
942+# * use of <> instead of !=
943 #
944-[DESIGN]
945-enable-design=no
946-
947-# Maximum number of arguments for function / method (see R0913)
948-max-args=10
949-
950-# Maximum number of locals for function / method body (see R0914)
951-max-locals=20
952-
953-# Maximum number of return / yield for function / method body
954-max-returns=10
955-
956-# Maximum number of branch for function / method body (see R0912)
957-max-branchs=15
958-
959-# Maximum number of statements in function / method body (see R0915)
960-max-statements=50
961-
962-# Maximum number of parents for a class (see R0901).
963-max-parents=7
964-
965-# Maximum number of attributes for a class (see R0902).
966-max-attributes=20
967-
968-# Minimum number of public methods for a class (see R0903).
969-min-public-methods=0
970-
971-# Maximum number of public methods for a class (see R0904).
972-max-public-methods=100
973+[FORMAT]
974+
975+# Maximum number of characters on a single line.
976+max-line-length=79
977+
978+# Maximum number of lines in a module
979+max-module-lines=2000
980+
981+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
982+# tab).
983+indent-string=' '
984
985
986 # checks for similarities and duplicated code. This computation may be
987@@ -267,7 +281,6 @@
988 # problems.
989 #
990 [SIMILARITIES]
991-enable-similarities=no
992
993 # Minimum lines number of a similarity.
994 min-similarity-lines=4
995@@ -284,27 +297,6 @@
996 # * PEP 263: source code with non ascii character but no encoding declaration
997 #
998 [MISCELLANEOUS]
999-enable-miscellaneous=no
1000
1001 # List of note tags to take in consideration, separated by a comma.
1002-notes=FIXME,XXX,TODO,fixme,todo
1003-
1004-
1005-# checks for :
1006-# * unauthorized constructions
1007-# * strict indentation
1008-# * line length
1009-# * use of <> instead of !=
1010-#
1011-[FORMAT]
1012-enable-format=yes
1013-
1014-# Maximum number of characters on a single line.
1015-max-line-length=79
1016-
1017-# Maximum number of lines in a module
1018-max-module-lines=1500
1019-
1020-# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
1021-# tab).
1022-indent-string=' '
1023+notes=FIXME,XXX,TODO,fixme,xxx,todo
1024
1025=== modified file 'test'
1026--- test 2010-08-13 18:34:05 +0000
1027+++ test 2010-09-14 21:39:47 +0000
1028@@ -16,6 +16,12 @@
1029 # You should have received a copy of the GNU General Public License along
1030 # with this program. If not, see <http://www.gnu.org/licenses/>.
1031
1032-`which xvfb-run` trial magicicada$@
1033-pylint magicicada
1034-pep8 --repeat .
1035+if [ $# -ne 0 ]; then
1036+ MODULE="$@"
1037+else
1038+ MODULE="magicicada"
1039+fi
1040+
1041+echo "Running test suite for ""$MODULE"
1042+`which xvfb-run` trial "$MODULE" && pylint magicicada && pep8 --repeat .
1043+rm -rf _trial_temp

Subscribers

People subscribed via source and target branches

to all changes: