Merge lp:~nskaggs/ubuntu-calendar-app/fix-illogical-tests into lp:ubuntu-calendar-app

Proposed by Nicholas Skaggs
Status: Rejected
Rejected by: Alan Pope 🍺🐧🐱 πŸ¦„
Proposed branch: lp:~nskaggs/ubuntu-calendar-app/fix-illogical-tests
Merge into: lp:ubuntu-calendar-app
Diff against target: 129 lines (+17/-51)
3 files modified
tests/autopilot/calendar_app/tests/test_dayview.py (+0/-17)
tests/autopilot/calendar_app/tests/test_monthview.py (+6/-11)
tests/autopilot/calendar_app/tests/test_weekview.py (+11/-23)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-calendar-app/fix-illogical-tests
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Ubuntu Calendar Developers Pending
Review via email: mp+259841@code.launchpad.net

Commit message

Fix common test failures in trunk by removing illogical bits and locale specifics that don't test well.

Description of the change

Fix common test failures in trunk by removing illogical bits and locale specifics that don't test well.

To post a comment you must log in.
650. By Nicholas Skaggs

remove to_local_date conversions

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

PEP8 failures...

./tests/autopilot/calendar_app/tests/test_weekview.py:165:1: W293 blank line contains whitespace

^
./tests/autopilot/calendar_app/tests/test_weekview.py:174:1: W293 blank line contains whitespace

^
./debian/tmp/usr/lib/python3/dist-packages/calendar_app/tests/test_weekview.py:165:1: W293 blank line contains whitespace

^
./debian/tmp/usr/lib/python3/dist-packages/calendar_app/tests/test_weekview.py:174:1: W293 blank line contains whitespace

^
./debian/calendar-app-autopilot/usr/lib/python3/dist-packages/calendar_app/tests/test_weekview.py:165:1: W293 blank line contains whitespace

^
./debian/calendar-app-autopilot/usr/lib/python3/dist-packages/calendar_app/tests/test_weekview.py:174:1: W293 blank line contains whitespace

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
2--- tests/autopilot/calendar_app/tests/test_dayview.py 2015-05-07 18:06:41 +0000
3+++ tests/autopilot/calendar_app/tests/test_dayview.py 2015-05-21 20:01:48 +0000
4@@ -75,23 +75,6 @@
5 self.assertEquals(
6 self.day_view.get_datelabel(today).text, str(now.day))
7
8- # Qt locale will return 0 for Sunday as first day of week
9- # and will return 1 for monday.
10- first_day_of_week = self.day_view.get_timeline_header(today).\
11- firstDayOfWeek
12- if first_day_of_week == 1:
13- week = int(now.strftime("%W"))+1
14- elif first_day_of_week == 0:
15- week = int(now.strftime("%U"))+1
16-
17- logger.warn(first_day_of_week)
18- logger.warn(now)
19- logger.warn(str(week))
20- logger.warn(self.day_view.get_weeknumer(today).text)
21- # Checking week number is correct
22- self.assertEquals(
23- self.day_view.get_weeknumer(today).text, 'W' + str(week))
24-
25 # Check day is scrolled to the current time
26 self.assertEquals(self.day_view.get_scrollHour(), now.hour)
27
28
29=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
30--- tests/autopilot/calendar_app/tests/test_monthview.py 2015-05-07 12:25:20 +0000
31+++ tests/autopilot/calendar_app/tests/test_monthview.py 2015-05-21 20:01:48 +0000
32@@ -44,17 +44,14 @@
33 direction = int(math.copysign(1, delta))
34
35 for _ in range(abs(delta)):
36- before = self.app.main_view.to_local_date(
37- month_view.currentMonth.datetime)
38+ before = month_view.currentMonth.datetime
39
40 # prevent timing issues with swiping
41- old_month = self.app.main_view.to_local_date(
42- month_view.currentMonth.datetime)
43+ old_month = month_view.currentMonth.datetime
44
45 self.app.main_view.swipe_view(direction, month_view)
46
47- month_after = self.app.main_view.to_local_date(
48- month_view.currentMonth.datetime)
49+ month_after = month_view.currentMonth.datetime
50
51 self.assertThat(lambda: month_after,
52 Eventually(NotEquals(old_month)))
53@@ -69,10 +66,11 @@
54 Eventually(Equals(after.year)))
55
56 def _assert_today(self):
57- local = self.app.main_view.to_local_date(
58- self.month_view.currentMonth.datetime)
59 today = datetime.now()
60+ local = self.month_view.currentMonth.datetime
61+ converted_local = self.app.main_view.to_local_date(local)
62 logger.debug(local)
63+ logger.debug(converted_local)
64 logger.debug(today)
65
66 self.assertThat(lambda: local.day,
67@@ -83,12 +81,9 @@
68 Eventually(Equals(today.year)))
69
70 def _go_to_today(self, delta):
71- self._assert_today()
72-
73 self._change_month(delta)
74 header = self.app.main_view.get_header()
75 header.click_action_button('todaybutton')
76-
77 self._assert_today()
78
79 def test_monthview_go_to_today_next_month(self):
80
81=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
82--- tests/autopilot/calendar_app/tests/test_weekview.py 2015-05-09 02:20:09 +0000
83+++ tests/autopilot/calendar_app/tests/test_weekview.py 2015-05-21 20:01:48 +0000
84@@ -156,21 +156,13 @@
85
86 def test_selecting_a_day_switches_to_day_view(self):
87 """It must be possible to show a single day by clicking on it."""
88- days = self.week_view.get_days_of_week()
89 today = datetime.datetime.now()
90-
91- # selecting today
92- index = 0
93- for i in range(len(days)):
94- if days[i] == today.day:
95- index = i
96-
97- day_to_select = self.app.main_view.get_label_with_text(days[index])
98- expected_day = days[index]
99- dayStart = self.week_view.firstDay
100- expected_month = dayStart.month
101- expected_year = dayStart.year
102-
103+ day_to_select = self.week_view.get_current_headerdatecomponent(today)
104+
105+ expected_day = day_to_select.date.day
106+ expected_month = day_to_select.date.month
107+ expected_year = day_to_select.date.year
108+
109 self.app.pointing_device.click_object(day_to_select)
110
111 # Check that the view changed from 'Week' to 'Day'
112@@ -178,12 +170,8 @@
113 self.assertThat(day_view.visible, Eventually(Equals(True)))
114
115 # Check that the 'Day' view is on the correct/selected day.
116- selected_date = \
117- self.app.main_view.get_day_view().get_selected_day().startDay
118-
119- logger.debug(expected_day)
120- logger.debug(selected_date)
121-
122- self.assertThat(expected_day, Equals(selected_date.day))
123- self.assertThat(expected_month, Equals(selected_date.month))
124- self.assertThat(expected_year, Equals(selected_date.year))
125+ day = self.app.main_view.get_day_view().get_selected_day().startDay
126+
127+ self.assertThat(expected_day, Equals(day.day))
128+ self.assertThat(expected_month, Equals(day.month))
129+ self.assertThat(expected_year, Equals(day.year))

Subscribers

People subscribed via source and target branches

to status/vote changes: