Autopilot tests assume English locale

Bug #1268574 reported by Olivier Tilloy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu Calendar App
Fix Released
Medium
Olivier Tilloy

Bug Description

Some autopilot tests fail when run locally on a system with a locale setting that is not English.
On my laptop (where LANG=fr_FR.UTF-8), one of such failures is for calendar_app.tests.test_dayview.TestDayView.test_current_month_and_year_is_selected:

Traceback (most recent call last):
  File "/home/osomon/dev/phablet/calendar-app/tests/autopilot/calendar_app/tests/test_dayview.py", line 44, in test_current_month_and_year_is_selected
    Equals(expected_month_name))
  File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 412, in assertThat
    raise MismatchError(matchee, matcher, mismatch, verbose)
MismatchError: 'January' != u'janvier'

The tests should be fixed to not make implicit assumptions on the current locale.

Related branches

Olivier Tilloy (osomon)
description: updated
David Planella (dpm)
Changed in ubuntu-calendar-app:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Olivier Tilloy (osomon) wrote :

The quickest way to fix that (tested here locally) is probably to unset the locale before launching the application in the autopilot tests:

=== modified file 'tests/autopilot/calendar_app/tests/__init__.py'
--- tests/autopilot/calendar_app/tests/__init__.py 2014-01-18 23:29:11 +0000
+++ tests/autopilot/calendar_app/tests/__init__.py 2014-01-28 15:06:16 +0000
@@ -62,6 +62,11 @@
             #disabling for now
             #self.addCleanup(os.system("start maliit-server"))

+ # Unset the current locale to ensure locale-specific data
+ # (day and month names, first day of the week, …) doesn’t get
+ # in the way of test expectations.
+ self.patch_environment('LC_ALL', 'C')
+
         if os.path.exists(self.local_location):
             self.launch_test_local()
         elif os.path.exists(self.installed_location):

Olivier Tilloy (osomon)
Changed in ubuntu-calendar-app:
assignee: nobody → Olivier Tilloy (osomon)
status: Triaged → In Progress
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

Fix committed into lp:ubuntu-calendar-app at revision 189, scheduled for release in ubuntu-calendar-app, milestone alpha-1

Changed in ubuntu-calendar-app:
status: In Progress → Fix Committed
Changed in ubuntu-calendar-app:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.