Code review comment for lp:~pkunal-parmar/ubuntu-calendar-app/nextYearFix

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

121 months = year_grid.select_many("MonthComponent")
122 self.assert_current_year_is_default_one(months[0])
123
124 - february = months[1]
125 + february = months[0]

No way February is the first month of the year.
select_many(…) doesn’t guarantee the order of the returned elements, which is why it seems January doesn’t come first, so hardcoding the index of the month is unreliable and this test is flaky.
What you need to do is to sort the list of months using their properties before accessing them by index. Something like that:

  months.sort(key=lambda month: month.monthDate)

With that, you can revert the index change, you will be guaranteed that february == months[1]

review: Needs Fixing

« Back to merge proposal