Merge lp:~osomon/ubuntu-calendar-app/fix-ap-test-assumption into lp:ubuntu-calendar-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 100
Merged at revision: 101
Proposed branch: lp:~osomon/ubuntu-calendar-app/fix-ap-test-assumption
Merge into: lp:ubuntu-calendar-app
Diff against target: 16 lines (+5/-1)
1 file modified
tests/autopilot/calendar_app/emulators/main_view.py (+5/-1)
To merge this branch: bzr merge lp:~osomon/ubuntu-calendar-app/fix-ap-test-assumption
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Kunal Parmar Approve
Review via email: mp+183476@code.launchpad.net

Commit message

Do not assume there will always be a label with the given text.

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)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

But if test runs multiple times then it will have more than one label with same text, as currently we are using hard coded time.

review: Needs Information
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
Kunal Parmar (pkunal-parmar) wrote :

> But if test runs multiple times then it will have more than one label with
> same text, as currently we are using hard coded time.

Sorry, i misinterpreted the code. Just ignore the comment

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

I tried to do the tests without a clean enviroment, and it doesn't passed: http://paste.ubuntu.com/6055487/

After this, I delete the database from ~/.locale and it passed.

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

So reason for the fail was due to multiple labels, I thought there is some timing issue ?

Revision history for this message
Olivier Tilloy (osomon) wrote :

I just spent quite some time investigating why the test sometimes passed, and sometimes failed.
It turns out the logic in TimeLineBase.qml is rather broken: it creates an event map that associates one event to each hour of the day. That means that there cannot be more than one event for a given slot of one hour. Obviously this doesn’t work. I filed bug #1219930 to track the issue.

Revision history for this message
Olivier Tilloy (osomon) wrote :

As pointed out by Riccardo, deleting the db before running the tests ensures that the test will always pass.
Assuming that the db is clean is not safe though (unless we modify the test runner to clear the db before each run).

I would advise to merge this change as is. It won’t make the test pass all the time (because of bug #1219930), but it should still make the situation better.

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

I agree, I will work on bug you mentioned.

review: Approve
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
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) :
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/emulators/main_view.py'
2--- tests/autopilot/calendar_app/emulators/main_view.py 2013-08-27 14:41:12 +0000
3+++ tests/autopilot/calendar_app/emulators/main_view.py 2013-09-02 14:45:40 +0000
4@@ -26,7 +26,11 @@
5 return self.select_single("DayView")
6
7 def get_title_label(self, title):
8- return self.select_many("Label", text=title)[0]
9+ labels = self.select_many("Label", text=title)
10+ if (len(labels) > 0):
11+ return labels[0]
12+ else:
13+ return None
14
15 def get_new_event(self):
16 return self.select_single("NewEvent")

Subscribers

People subscribed via source and target branches

to status/vote changes: