Merge lp:~elopio/ubuntu-calendar-app/fix1334777-pep8 into lp:ubuntu-calendar-app

Proposed by Leo Arias
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 335
Merged at revision: 335
Proposed branch: lp:~elopio/ubuntu-calendar-app/fix1334777-pep8
Merge into: lp:ubuntu-calendar-app
Diff against target: 505 lines (+144/-113)
8 files modified
tests/autopilot/calendar_app/__init__.py (+14/-5)
tests/autopilot/calendar_app/emulators.py (+22/-13)
tests/autopilot/calendar_app/tests/__init__.py (+11/-11)
tests/autopilot/calendar_app/tests/test_calendar.py (+28/-51)
tests/autopilot/calendar_app/tests/test_dayview.py (+15/-6)
tests/autopilot/calendar_app/tests/test_monthview.py (+15/-6)
tests/autopilot/calendar_app/tests/test_weekview.py (+24/-15)
tests/autopilot/calendar_app/tests/test_yearview.py (+15/-6)
To merge this branch: bzr merge lp:~elopio/ubuntu-calendar-app/fix1334777-pep8
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Julia Palandri (community) Approve
Mihir Soni Approve
Review via email: mp+224700@code.launchpad.net

Commit message

Fixed the new new pep8 errors and the copyright headers.

Description of the change

Fixed the new new pep8 errors and the copyright headers

To post a comment you must log in.
Revision history for this message
Mihir Soni (mihirsoni) wrote :

Looks good to me thanks.

review: Approve
Revision history for this message
Julia Palandri (julia-palandri) wrote :

ran pep8 and read diff, everything looks good

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/calendar_app/__init__.py'
2--- tests/autopilot/calendar_app/__init__.py 2013-05-29 09:26:13 +0000
3+++ tests/autopilot/calendar_app/__init__.py 2014-06-26 18:11:36 +0000
4@@ -1,8 +1,17 @@
5 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
6-# Copyright 2013 Canonical
7-#
8-# This program is free software: you can redistribute it and/or modify it
9-# under the terms of the GNU General Public License version 3, as published
10-# by the Free Software Foundation.
11+#
12+# Copyright (C) 2013, 2014 Canonical Ltd
13+#
14+# This program is free software: you can redistribute it and/or modify
15+# it under the terms of the GNU General Public License version 3 as
16+# published by the Free Software Foundation.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU General Public License for more details.
22+#
23+# You should have received a copy of the GNU General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25
26 """calendar-app tests and emulators - top level package."""
27
28=== modified file 'tests/autopilot/calendar_app/emulators.py'
29--- tests/autopilot/calendar_app/emulators.py 2014-06-06 18:08:55 +0000
30+++ tests/autopilot/calendar_app/emulators.py 2014-06-26 18:11:36 +0000
31@@ -1,9 +1,18 @@
32 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
33-# Copyright 2013 Canonical
34-#
35-# This program is free software: you can redistribute it and/or modify it
36-# under the terms of the GNU General Public License version 3, as published
37-# by the Free Software Foundation.
38+#
39+# Copyright (C) 2013, 2014 Canonical Ltd
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU General Public License version 3 as
43+# published by the Free Software Foundation.
44+#
45+# This program is distributed in the hope that it will be useful,
46+# but WITHOUT ANY WARRANTY; without even the implied warranty of
47+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48+# GNU General Public License for more details.
49+#
50+# You should have received a copy of the GNU General Public License
51+# along with this program. If not, see <http://www.gnu.org/licenses/>.
52
53 """Calendar app autopilot emulators."""
54 from time import sleep
55@@ -22,9 +31,9 @@
56 """Autopilot helper for the NewEventEntryField component."""
57
58
59-#for now we are borrowing the textfield helper for the textarea
60-#once the toolkit has a textarea helper this should be removed
61-#https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1327354
62+# for now we are borrowing the textfield helper for the textarea
63+# once the toolkit has a textarea helper this should be removed
64+# https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1327354
65 class TextArea(toolkit_emulators.TextField):
66 """Autopilot helper for the TextArea component."""
67
68@@ -36,7 +45,7 @@
69 """
70
71 def set_picker(self, field, mode, value):
72- #open picker
73+ # open picker
74 self.pointing_device.click_object(field)
75 # valid options are date or time; assume date if invalid/no option
76 if mode == 'time':
77@@ -49,7 +58,7 @@
78 picker.pick_time(value)
79 else:
80 picker.pick_date(value)
81- #close picker
82+ # close picker
83 self.pointing_device.click_object(field)
84
85 def get_event_view(self):
86@@ -130,11 +139,11 @@
87 """
88 timeout = 0
89 before = date
90- #try up to 3 times to swipe
91+ # try up to 3 times to swipe
92 while timeout < 3 and date == before:
93 self._swipe(direction, view)
94- #check for up to 3 seconds after swipe for view
95- #to have changed before trying again
96+ # check for up to 3 seconds after swipe for view
97+ # to have changed before trying again
98 for x in range(0, 3):
99 if date != before:
100 break
101
102=== modified file 'tests/autopilot/calendar_app/tests/__init__.py'
103--- tests/autopilot/calendar_app/tests/__init__.py 2014-06-18 09:03:51 +0000
104+++ tests/autopilot/calendar_app/tests/__init__.py 2014-06-26 18:11:36 +0000
105@@ -1,6 +1,6 @@
106 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
107 #
108-# Copyright (C) 2013 Canonical Ltd
109+# Copyright (C) 2013, 2014 Canonical Ltd
110 #
111 # This program is free software: you can redistribute it and/or modify
112 # it under the terms of the GNU General Public License version 3 as
113@@ -102,10 +102,10 @@
114 def _copy_xauthority_file(self, directory):
115 """ Copy .Xauthority file to directory, if it exists in /home
116 """
117- #If running under xvfb, as jenkins does,
118- #xsession will fail to start without xauthority file
119- #Thus if the Xauthority file is in the home directory
120- #make sure we copy it to our temp home directory
121+ # If running under xvfb, as jenkins does,
122+ # xsession will fail to start without xauthority file
123+ # Thus if the Xauthority file is in the home directory
124+ # make sure we copy it to our temp home directory
125
126 xauth = os.path.expanduser(os.path.join(os.environ.get('HOME'),
127 '.Xauthority'))
128@@ -119,8 +119,8 @@
129 def _patch_home(self):
130 """ mock /home for testing purposes to preserve user data
131 """
132- #click requires apparmor profile, and writing to special dir
133- #but the desktop can write to a traditional /tmp directory
134+ # click requires apparmor profile, and writing to special dir
135+ # but the desktop can write to a traditional /tmp directory
136 if self.test_type == 'click':
137 env_dir = os.path.join(os.environ.get('HOME'), 'autopilot',
138 'fakeenv')
139@@ -131,8 +131,8 @@
140 temp_dir_fixture = fixtures.TempDir(env_dir)
141 self.useFixture(temp_dir_fixture)
142
143- #apparmor doesn't allow the app to create needed directories,
144- #so we create them now
145+ # apparmor doesn't allow the app to create needed directories,
146+ # so we create them now
147 temp_dir = temp_dir_fixture.path
148 temp_dir_cache = os.path.join(temp_dir, '.cache')
149 temp_dir_cache_font = os.path.join(temp_dir_cache, 'fontconfig')
150@@ -165,7 +165,7 @@
151 if not os.path.exists(temp_dir_confined):
152 os.makedirs(temp_dir_confined)
153
154- #before we set fixture, copy xauthority if needed
155+ # before we set fixture, copy xauthority if needed
156 self._copy_xauthority_file(temp_dir)
157 self.useFixture(toolkit_fixtures.InitctlEnvironmentVariable(
158 HOME=temp_dir))
159@@ -174,7 +174,7 @@
160 self.useFixture(temp_dir_fixture)
161 temp_dir = temp_dir_fixture.path
162
163- #before we set fixture, copy xauthority if needed
164+ # before we set fixture, copy xauthority if needed
165 self._copy_xauthority_file(temp_dir)
166 self.useFixture(fixtures.EnvironmentVariable('HOME',
167 newvalue=temp_dir))
168
169=== modified file 'tests/autopilot/calendar_app/tests/test_calendar.py'
170--- tests/autopilot/calendar_app/tests/test_calendar.py 2014-06-17 16:23:49 +0000
171+++ tests/autopilot/calendar_app/tests/test_calendar.py 2014-06-26 18:11:36 +0000
172@@ -1,9 +1,18 @@
173 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
174-# Copyright 2013 Canonical
175-#
176-# This program is free software: you can redistribute it and/or modify it
177-# under the terms of the GNU General Public License version 3, as published
178-# by the Free Software Foundation.
179+#
180+# Copyright (C) 2013, 2014 Canonical Ltd
181+#
182+# This program is free software: you can redistribute it and/or modify
183+# it under the terms of the GNU General Public License version 3 as
184+# published by the Free Software Foundation.
185+#
186+# This program is distributed in the hope that it will be useful,
187+# but WITHOUT ANY WARRANTY; without even the implied warranty of
188+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
189+# GNU General Public License for more details.
190+#
191+# You should have received a copy of the GNU General Public License
192+# along with this program. If not, see <http://www.gnu.org/licenses/>.
193
194 """Calendar app autopilot tests."""
195
196@@ -13,89 +22,57 @@
197 from calendar_app.tests import CalendarTestCase
198
199 import time
200-#import datetime
201
202
203 class TestMainView(CalendarTestCase):
204
205 def test_new_event(self):
206 """test add new event """
207- #go to today
208+ # go to today
209 self.main_view.switch_to_tab("dayTab")
210 header = self.main_view.get_header()
211 header.click_action_button('todaybutton')
212 num_events = self.main_view.get_num_events()
213
214- # calculate some dates
215- #today = self.main_view.get_day_view().currentDay.datetime
216- #yesterday = today + datetime.timedelta(days=-1)
217- #tomorrow = today + datetime.timedelta(days=1)
218-
219- #start_time = datetime.time(6, 5)
220- #end_time = datetime.time(11, 38)
221-
222- #click on new event button
223+ # click on new event button
224 header = self.main_view.get_header()
225 header.click_action_button('neweventbutton')
226 self.assertThat(self.main_view.get_new_event,
227 Eventually(Not(Is(None))))
228
229- #due to https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1326963
230- #the first event triggered is ignored, so we trigger an event
231- #and a small sleep to clear before continuing input
232+ # due to https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1326963
233+ # the first event triggered is ignored, so we trigger an event
234+ # and a small sleep to clear before continuing input
235 event_name_field = self.main_view.get_new_event_name_input_box()
236 self.pointing_device.click_object(event_name_field)
237 time.sleep(1)
238
239- #due to https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1328600
240- #we cannot interact to set date / time, so disabling this for now
241-
242- # Set the start date
243- #self.main_view.set_picker(self.main_view.get_event_start_date_field(),
244- # 'date',
245- # yesterday)
246-
247- # Set the end date
248- #self.main_view.set_picker(self.main_view.get_event_end_date_field(),
249- # 'date',
250- # tomorrow)
251-
252- # Set the start time
253- #self.main_view.set_picker(self.main_view.get_event_start_time_field(),
254- # 'time',
255- # start_time)
256-
257- # Set the end time
258- #self.main_view.set_picker(self.main_view.get_event_end_time_field(),
259- # 'time',
260- # end_time)
261-
262- #input a new event name
263+ # input a new event name
264 eventTitle = "Test event " + str(int(time.time()))
265 self.main_view.get_new_event_name_input_box().write(eventTitle)
266
267- #input description
268+ # input description
269 self.main_view.get_event_description_field(). \
270 write("My favorite test event")
271
272- #input location
273+ # input location
274 self.main_view.get_event_location_field().write("England")
275
276- #input guests
277+ # input guests
278 self.main_view.get_event_people_field().write("me, myself, and I")
279
280- #todo: iterate over all combinations
281- #and include recurrence and reminders
282+ # todo: iterate over all combinations
283+ # and include recurrence and reminders
284
285- #click save button
286+ # click save button
287 save_button = self.main_view.get_new_event_save_button()
288 self.pointing_device.click_object(save_button)
289
290- #verify that the event has been created in timeline
291+ # verify that the event has been created in timeline
292 self.main_view.switch_to_tab("dayTab")
293 header = self.main_view.get_header()
294 header.click_action_button('todaybutton')
295 self.assertThat(self.main_view.get_num_events,
296 Eventually(NotEquals(num_events)))
297
298- #todo: verify entered event data
299+ # todo: verify entered event data
300
301=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
302--- tests/autopilot/calendar_app/tests/test_dayview.py 2014-05-22 11:51:53 +0000
303+++ tests/autopilot/calendar_app/tests/test_dayview.py 2014-06-26 18:11:36 +0000
304@@ -1,9 +1,18 @@
305 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
306-# Copyright 2013 Canonical
307-#
308-# This program is free software: you can redistribute it and/or modify it
309-# under the terms of the GNU General Public License version 3, as published
310-# by the Free Software Foundation.
311+#
312+# Copyright (C) 2013, 2014 Canonical Ltd
313+#
314+# This program is free software: you can redistribute it and/or modify
315+# it under the terms of the GNU General Public License version 3 as
316+# published by the Free Software Foundation.
317+#
318+# This program is distributed in the hope that it will be useful,
319+# but WITHOUT ANY WARRANTY; without even the implied warranty of
320+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
321+# GNU General Public License for more details.
322+#
323+# You should have received a copy of the GNU General Public License
324+# along with this program. If not, see <http://www.gnu.org/licenses/>.
325
326 """
327 Calendar app autopilot tests for the day view.
328@@ -81,7 +90,7 @@
329 firstday = self.day_view.currentDay.datetime
330
331 for i in range(1, 5):
332- #prevent timing issues with swiping
333+ # prevent timing issues with swiping
334 old_day = self.day_view.currentDay.datetime
335 self.main_view.swipe_view(direction, self.day_view)
336 self.assertThat(lambda: self.day_view.currentDay.datetime,
337
338=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
339--- tests/autopilot/calendar_app/tests/test_monthview.py 2014-05-23 12:00:18 +0000
340+++ tests/autopilot/calendar_app/tests/test_monthview.py 2014-06-26 18:11:36 +0000
341@@ -1,9 +1,18 @@
342 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
343-# Copyright 2013 Canonical
344-#
345-# This program is free software: you can redistribute it and/or modify it
346-# under the terms of the GNU General Public License version 3, as published
347-# by the Free Software Foundation.
348+#
349+# Copyright (C) 2013, 2014 Canonical Ltd
350+#
351+# This program is free software: you can redistribute it and/or modify
352+# it under the terms of the GNU General Public License version 3 as
353+# published by the Free Software Foundation.
354+#
355+# This program is distributed in the hope that it will be useful,
356+# but WITHOUT ANY WARRANTY; without even the implied warranty of
357+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
358+# GNU General Public License for more details.
359+#
360+# You should have received a copy of the GNU General Public License
361+# along with this program. If not, see <http://www.gnu.org/licenses/>.
362
363 """Calendar app autopilot tests."""
364
365@@ -40,7 +49,7 @@
366 before = self.main_view.to_local_date(
367 month_view.currentMonth.datetime)
368
369- #prevent timing issues with swiping
370+ # prevent timing issues with swiping
371 old_month = self.main_view.to_local_date(
372 month_view.currentMonth.datetime)
373
374
375=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
376--- tests/autopilot/calendar_app/tests/test_weekview.py 2014-05-22 09:34:33 +0000
377+++ tests/autopilot/calendar_app/tests/test_weekview.py 2014-06-26 18:11:36 +0000
378@@ -1,9 +1,18 @@
379 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
380-# Copyright 2013 Canonical
381-#
382-# This program is free software: you can redistribute it and/or modify it
383-# under the terms of the GNU General Public License version 3, as published
384-# by the Free Software Foundation.
385+#
386+# Copyright (C) 2013, 2014 Canonical Ltd
387+#
388+# This program is free software: you can redistribute it and/or modify
389+# it under the terms of the GNU General Public License version 3 as
390+# published by the Free Software Foundation.
391+#
392+# This program is distributed in the hope that it will be useful,
393+# but WITHOUT ANY WARRANTY; without even the implied warranty of
394+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
395+# GNU General Public License for more details.
396+#
397+# You should have received a copy of the GNU General Public License
398+# along with this program. If not, see <http://www.gnu.org/licenses/>.
399
400 """
401 Calendar app autopilot tests for the week view.
402@@ -40,7 +49,7 @@
403 def _change_week(self, direction):
404 first_dow = self._get_first_day_of_week()
405
406- #prevent timing issues with swiping
407+ # prevent timing issues with swiping
408 old_day = self.main_view.to_local_date(
409 self.week_view.dayStart.datetime)
410 self.main_view.swipe_view(direction, self.week_view)
411@@ -58,13 +67,13 @@
412 self.assertThat(new_day_start.day, Equals(expected_day_start.day))
413
414 def _get_days_of_week(self):
415- #sort based on text value of the day
416+ # sort based on text value of the day
417 days = sorted(self._get_date_label_headers(),
418 key=lambda label: label.text)
419 days = [int(item.text) for item in days]
420
421- #resort so beginning of next month comes after the end
422- #need to support overlapping months 28,30,31 -> 1
423+ # resort so beginning of next month comes after the end
424+ # need to support overlapping months 28,30,31 -> 1
425 sorteddays = []
426 for day in days:
427 inserted = 0
428@@ -89,23 +98,23 @@
429 firstDay = self.main_view.to_local_date(
430 self.week_view.firstDay.datetime)
431
432- #sunday
433+ # sunday
434 if firstDay.weekday() == 6:
435 logger.debug("Locale has Sunday as first day of week")
436 weekday = date.weekday()
437 diff = datetime.timedelta(days=weekday + 1)
438- #saturday
439+ # saturday
440 elif firstDay.weekday() == 5:
441 logger.debug("Locale has Saturday as first day of week")
442 weekday = date.weekday()
443 diff = datetime.timedelta(days=weekday + 2)
444- #monday
445+ # monday
446 else:
447 logger.debug("Locale has Monday as first day of week")
448 weekday = date.weekday()
449 diff = datetime.timedelta(days=weekday)
450
451- #set the start of week
452+ # set the start of week
453 if date.day != firstDay.day:
454 day_start = date - diff
455 logger.debug("Setting day_start to %s" % firstDay.day)
456@@ -172,11 +181,11 @@
457
458 self.pointing_device.click_object(day_to_select)
459
460- #Check that the view changed from 'Week' to 'Day'
461+ # Check that the view changed from 'Week' to 'Day'
462 day_view = self.main_view.get_day_view()
463 self.assertThat(day_view.visible, Eventually(Equals(True)))
464
465- #Check that the 'Day' view is on the correct/selected day.
466+ # Check that the 'Day' view is on the correct/selected day.
467 selected_date = day_view.select_single("TimeLineHeader").date
468 self.assertThat(expected_day, Equals(selected_date.day))
469 self.assertThat(expected_month, Equals(selected_date.month))
470
471=== modified file 'tests/autopilot/calendar_app/tests/test_yearview.py'
472--- tests/autopilot/calendar_app/tests/test_yearview.py 2014-05-22 09:34:33 +0000
473+++ tests/autopilot/calendar_app/tests/test_yearview.py 2014-06-26 18:11:36 +0000
474@@ -1,9 +1,18 @@
475 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
476-# Copyright 2013 Canonical
477-#
478-# This program is free software: you can redistribute it and/or modify it
479-# under the terms of the GNU General Public License version 3, as published
480-# by the Free Software Foundation.
481+#
482+# Copyright (C) 2013, 2014 Canonical Ltd
483+#
484+# This program is free software: you can redistribute it and/or modify
485+# it under the terms of the GNU General Public License version 3 as
486+# published by the Free Software Foundation.
487+#
488+# This program is distributed in the hope that it will be useful,
489+# but WITHOUT ANY WARRANTY; without even the implied warranty of
490+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
491+# GNU General Public License for more details.
492+#
493+# You should have received a copy of the GNU General Public License
494+# along with this program. If not, see <http://www.gnu.org/licenses/>.
495
496 """
497 Calendar app autopilot tests for the year view.
498@@ -46,7 +55,7 @@
499 self.assertThat(year_grid, NotEquals(None))
500 months = year_grid.select_many("MonthComponent")
501 months.sort(key=lambda month: month.currentMonth)
502- #check that current year is the default
503+ # check that current year is the default
504 self.assertThat(self.main_view.get_year(months[0]),
505 Equals(datetime.now().year))
506

Subscribers

People subscribed via source and target branches

to status/vote changes: