Merge lp:~nskaggs/ubuntu-calendar-app/debug-ap-tests into lp:ubuntu-calendar-app

Proposed by Nicholas Skaggs
Status: Rejected
Rejected by: Nicholas Skaggs
Proposed branch: lp:~nskaggs/ubuntu-calendar-app/debug-ap-tests
Merge into: lp:ubuntu-calendar-app
Diff against target: 180 lines (+46/-26)
5 files modified
tests/autopilot/calendar_app/emulators.py (+2/-2)
tests/autopilot/calendar_app/tests/test_dayview.py (+15/-11)
tests/autopilot/calendar_app/tests/test_monthview.py (+9/-2)
tests/autopilot/calendar_app/tests/test_weekview.py (+7/-5)
tests/autopilot/calendar_app/tests/test_yearview.py (+13/-6)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-calendar-app/debug-ap-tests
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Calendar Developers Pending
Review via email: mp+202691@code.launchpad.net

Commit message

Add logging for debugging purposes
Change timedelta calculations and asserts

Description of the change

Attempt #2 at understanding maguro issues for calendar

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
185. By Nicholas Skaggs

fix pep8 and pyflakes

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
186. By Nicholas Skaggs

fix timedelta's

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
187. By Nicholas Skaggs

fix dayview and yearview

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
188. By Nicholas Skaggs

tweak year, month, day changing, along with loggin

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
189. By Nicholas Skaggs

fix year change logic

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
190. By Nicholas Skaggs

fix pep8 and pyflakes

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

test tweaking swipe size

192. By Nicholas Skaggs

tweak a little again

193. By Nicholas Skaggs

remove logging

194. By Nicholas Skaggs

further tweaks for swiping

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: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

It seems like rev 191 came closest to passing (only 1 failure in previous day test) for maguro. Best to work off that version. The other revs 192+ all fail per usual in the lab.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Filed this bug; confirmed this is an application issue, not something incorrect with the tests.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Unmerged revisions

194. By Nicholas Skaggs

further tweaks for swiping

193. By Nicholas Skaggs

remove logging

192. By Nicholas Skaggs

tweak a little again

191. By Nicholas Skaggs

test tweaking swipe size

190. By Nicholas Skaggs

fix pep8 and pyflakes

189. By Nicholas Skaggs

fix year change logic

188. By Nicholas Skaggs

tweak year, month, day changing, along with loggin

187. By Nicholas Skaggs

fix dayview and yearview

186. By Nicholas Skaggs

fix timedelta's

185. By Nicholas Skaggs

fix pep8 and pyflakes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/calendar_app/emulators.py'
2--- tests/autopilot/calendar_app/emulators.py 2013-12-16 21:32:43 +0000
3+++ tests/autopilot/calendar_app/emulators.py 2014-01-23 19:40:45 +0000
4@@ -87,8 +87,8 @@
5
6 """
7
8- start = (-direction * x_pad) % 1
9- stop = (direction * x_pad) % 1
10+ start = ((-direction * x_pad) % 1) / 1.5
11+ stop = (direction * x_pad) % 1 / 1.5
12
13 y_line = view.globalRect[1] + view.globalRect[3] / 2
14 x_start = view.globalRect[0] + view.globalRect[2] * start
15
16=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
17--- tests/autopilot/calendar_app/tests/test_dayview.py 2014-01-09 23:30:55 +0000
18+++ tests/autopilot/calendar_app/tests/test_dayview.py 2014-01-23 19:40:45 +0000
19@@ -15,6 +15,9 @@
20 from testtools.matchers import Equals, NotEquals
21
22 from calendar_app.tests import CalendarTestCase
23+import logging
24+
25+logger = logging.getLogger(__name__)
26
27
28 class TestDayView(CalendarTestCase):
29@@ -72,21 +75,22 @@
30 self.change_days(-1)
31
32 def change_days(self, direction):
33- now = datetime.datetime.now()
34+ current_day = lambda: self.main_view.get_day_view().currentDay.datetime
35+ first_day = current_day()
36+ logger.debug("Today %s, delta %s" % (first_day, direction))
37
38 for i in xrange(1, 5):
39+ before = current_day()
40+ logger.debug("Before date %s" % (before))
41+ expected_day = (first_day + datetime.timedelta(
42+ days=(i * direction)))
43+ logger.debug("Expected date %s" % (expected_day))
44+
45 #prevent timing issues with swiping
46- old_day = self.day_view.currentDay.datetime
47 self.main_view.swipe_view(direction, self.day_view)
48- self.assertThat(lambda: self.day_view.currentDay.datetime,
49- Eventually(NotEquals(old_day)))
50-
51- current_day = self.day_view.currentDay.datetime
52-
53- expected_day = (now + datetime.timedelta(
54- days=(i * direction)))
55-
56- self.assertThat(self.strip(current_day),
57+ self.assertThat(current_day, Eventually(NotEquals(before)))
58+
59+ self.assertThat(self.strip(current_day()),
60 Equals(self.strip(expected_day)))
61
62 def strip(self, date):
63
64=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
65--- tests/autopilot/calendar_app/tests/test_monthview.py 2014-01-09 23:30:55 +0000
66+++ tests/autopilot/calendar_app/tests/test_monthview.py 2014-01-23 19:40:45 +0000
67@@ -18,6 +18,9 @@
68
69 from datetime import datetime
70 from dateutil.relativedelta import relativedelta
71+import logging
72+
73+logger = logging.getLogger(__name__)
74
75
76 class TestMonthView(CalendarTestCase):
77@@ -35,9 +38,15 @@
78 def change_month(self, delta):
79 month_view = self.main_view.get_month_view()
80 sign = int(math.copysign(1, delta))
81+ first_month = month_view.currentMonth.datetime
82+ logger.debug("First month %s, delta %s" % (first_month, delta))
83
84 for _ in range(abs(delta)):
85 before = month_view.currentMonth.datetime
86+ logger.debug("Before date %s" % (before))
87+
88+ after = before + relativedelta(months=sign)
89+ logger.debug("Expected date %s" % (after))
90
91 #prevent timing issues with swiping
92 old_month = month_view.currentMonth.datetime
93@@ -45,8 +54,6 @@
94 self.assertThat(lambda: month_view.currentMonth.datetime,
95 Eventually(NotEquals(old_month)))
96
97- after = before + relativedelta(months=sign)
98-
99 self.assertThat(lambda:
100 self.month_view.currentMonth.datetime.month,
101 Eventually(Equals(after.month)))
102
103=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
104--- tests/autopilot/calendar_app/tests/test_weekview.py 2014-01-09 23:30:55 +0000
105+++ tests/autopilot/calendar_app/tests/test_weekview.py 2014-01-23 19:40:45 +0000
106@@ -34,6 +34,11 @@
107
108 def _change_week(self, direction):
109 first_dow = self._get_first_day_of_week()
110+ logger.debug("First DOW %s, delta %s" % (first_dow, direction))
111+
112+ expected_day_start = first_dow + datetime.timedelta(
113+ days=(7 * direction))
114+ logger.debug("Expected first DOW %s" % (expected_day_start))
115
116 #prevent timing issues with swiping
117 old_day = self.week_view.dayStart.datetime
118@@ -43,9 +48,6 @@
119
120 new_day_start = self.week_view.dayStart.datetime
121
122- expected_day_start = first_dow + datetime.timedelta(
123- days=(7 * direction))
124-
125 self.assertThat(new_day_start.day, Equals(expected_day_start.day))
126
127 def _get_days_of_week(self):
128@@ -96,10 +98,10 @@
129 #set the start of week
130 if date.day != firstDay.day:
131 day_start = date - diff
132- logger.debug("Setting day_start to %s" % firstDay.day)
133+ logger.debug("Setting day_start to %s" % day_start)
134 else:
135 day_start = date
136- logger.debug("Using today as day_start %s" % date)
137+ logger.debug("Using today as day_start %s" % day_start)
138 return day_start
139
140 def test_current_month_and_year_is_selected(self):
141
142=== modified file 'tests/autopilot/calendar_app/tests/test_yearview.py'
143--- tests/autopilot/calendar_app/tests/test_yearview.py 2014-01-09 23:28:15 +0000
144+++ tests/autopilot/calendar_app/tests/test_yearview.py 2014-01-23 19:40:45 +0000
145@@ -15,6 +15,9 @@
146 from testtools.matchers import Equals, NotEquals
147
148 from calendar_app.tests import CalendarTestCase
149+import logging
150+
151+logger = logging.getLogger(__name__)
152
153
154 class TestYearView(CalendarTestCase):
155@@ -85,15 +88,19 @@
156 self.change_year(-1)
157
158 def change_year(self, direction, how_many=5):
159- current_year = datetime.now().year
160+ current_year = lambda: \
161+ self.main_view.get_year_view().currentYear.datetime.year
162+ first_year = current_year()
163+ logger.debug("Current year %s, delta %s" % (first_year, direction))
164
165 for i in xrange(1, how_many):
166- #prevent timing issues with swiping
167+ before = current_year()
168+ logger.debug("Before year %s" % (before))
169+ expected_year = first_year + (i * direction)
170+ logger.debug("Expected year %s" % (expected_year))
171+
172 self.main_view.swipe_view(direction, self.year_view)
173-
174- self.assertThat(
175- lambda: self.year_view.currentYear.year,
176- Eventually(Equals(current_year + (i * direction))))
177+ self.assertThat(current_year, Eventually(Equals(expected_year)))
178
179 def assert_current_year_is_default_one(self, month_component):
180 self.assertThat(self.main_view.get_year(month_component),

Subscribers

People subscribed via source and target branches

to status/vote changes: