Runing tests with LANG set makes some tests fail

Bug #951716 reported by Roberto Alsina on 2012-03-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu One Control Panel
Status tracked in Trunk
Stable-3-0
Undecided
Unassigned
Trunk
Low
Roberto Alsina
Ubuntu Single Sign On Client
Status tracked in Trunk
Stable-3-0
Undecided
Unassigned
Trunk
Low
Roberto Alsina

Bug Description

Trunk , revno 280:

If you run the tests like this:

LANG=es_ES.UTF-8 ./run-tests

These tests fail:

[FAIL]
Traceback (most recent call last):
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 110, in test_process_info_disabled
    tooltip=gui.FILE_SYNC_ENABLE_TOOLTIP)
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 64, in assert_status_correct
    self.assertEqual(expected_text, actual_text)
  File "/usr/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = u'La sincronizaci\xf3n de archivos est\xe1 desactivada.'
b = PyQt4.QtCore.QString(u'La sincronizaci\xf3n de archivos est\xe1 desactivada.')

ubuntuone.controlpanel.gui.qt.tests.test_filesyncstatus.FileSyncStatusTestCase.test_process_info_disabled
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 118, in test_process_info_disconnected
    tooltip=gui.FILE_SYNC_CONNECT_TOOLTIP)
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 64, in assert_status_correct
    self.assertEqual(expected_text, actual_text)
  File "/usr/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = u'La sincronizaci\xf3n de archivos est\xe1 desconectada.'
b = PyQt4.QtCore.QString(u'La sincronizaci\xf3n de archivos est\xe1 desconectada.')

ubuntuone.controlpanel.gui.qt.tests.test_filesyncstatus.FileSyncStatusTestCase.test_process_info_disconnected
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 128, in test_process_info_error
    tooltip=gui.FILE_SYNC_RESTART_TOOLTIP)
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 64, in assert_status_correct
    self.assertEqual(expected_text, actual_text)
  File "/usr/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = u'<font color="red"><b>Error en la sincronizaci\xf3n de archivos.</b></font> (what an error!)'
b = PyQt4.QtCore.QString(u'<font color="red"><b>Error en la sincronizaci\xf3n de archivos.</b></font> (what an error!)')

ubuntuone.controlpanel.gui.qt.tests.test_filesyncstatus.FileSyncStatusTestCase.test_process_info_error
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 136, in test_process_info_idle
    tooltip=gui.FILE_SYNC_DISCONNECT_TOOLTIP)
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 64, in assert_status_correct
    self.assertEqual(expected_text, actual_text)
  File "/usr/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = u'Sincronizaci\xf3n de archivos actualizada.'
b = PyQt4.QtCore.QString(u'Sincronizaci\xf3n de archivos actualizada.')

ubuntuone.controlpanel.gui.qt.tests.test_filesyncstatus.FileSyncStatusTestCase.test_process_info_idle
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 144, in test_process_info_starting
    tooltip=gui.FILE_SYNC_STOP_TOOLTIP)
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 64, in assert_status_correct
    self.assertEqual(expected_text, actual_text)
  File "/usr/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = u'Iniciando sincronizaci\xf3n de archivos...'
b = PyQt4.QtCore.QString(u'Iniciando sincronizaci\xf3n de archivos...')

ubuntuone.controlpanel.gui.qt.tests.test_filesyncstatus.FileSyncStatusTestCase.test_process_info_starting
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 152, in test_process_info_stopped
    tooltip=gui.FILE_SYNC_START_TOOLTIP)
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 64, in assert_status_correct
    self.assertEqual(expected_text, actual_text)
  File "/usr/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = u'Sincronizaci\xf3n de archivos detenida.'
b = PyQt4.QtCore.QString(u'Sincronizaci\xf3n de archivos detenida.')

ubuntuone.controlpanel.gui.qt.tests.test_filesyncstatus.FileSyncStatusTestCase.test_process_info_stopped
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 160, in test_process_info_syncing
    tooltip=gui.FILE_SYNC_DISCONNECT_TOOLTIP)
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 64, in assert_status_correct
    self.assertEqual(expected_text, actual_text)
  File "/usr/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = u'Sincronizaci\xf3n de archivos en progreso...'
b = PyQt4.QtCore.QString(u'Sincronizaci\xf3n de archivos en progreso...')

ubuntuone.controlpanel.gui.qt.tests.test_filesyncstatus.FileSyncStatusTestCase.test_process_info_syncing
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 170, in test_process_info_unknown
    tooltip=gui.FILE_SYNC_RESTART_TOOLTIP)
  File "/home/ralsina/canonical/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py", line 64, in assert_status_correct
    self.assertEqual(expected_text, actual_text)
  File "/usr/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = u'<font color="red"><b>Error en la sincronizaci\xf3n de archivos.</b></font> (yadda oops)'
b = PyQt4.QtCore.QString(u'<font color="red"><b>Error en la sincronizaci\xf3n de archivos.</b></font> (yadda oops)')

ubuntuone.controlpanel.gui.qt.tests.test_filesyncstatus.FileSyncStatusTestCase.test_process_info_unknown
-------------------------------------------------------------------------------
Ran 855 tests in 9.692s

FAILED (skips=2, failures=8, successes=845)

Related branches

Roberto Alsina (ralsina) on 2012-03-12
Changed in ubuntuone-control-panel:
assignee: nobody → Roberto Alsina (ralsina)
status: New → In Progress
Roberto Alsina (ralsina) wrote :

There is some weirdness about comparing QStrings and unicodes:

>>> u'a' == QtCore.QString(u'a')
True
>>> u'á' == QtCore.QString(u'á')
__main__:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
False
>>> u'á' == unicode(QtCore.QString(u'á'))
True

Therefore, whenever we compare unicode to strings we get from Qt (like using widget.text() or whatever), we need to manually convert the QString to unicode prior to comparison.

These 9 tests fail on spanish because they are the 9 strings we are comparing that have non-ascii characters in them. In other locales other tests may fail.

Changed in ubuntu-sso-client:
assignee: nobody → Roberto Alsina (ralsina)
status: New → Triaged
importance: Undecided → Low
Changed in ubuntuone-control-panel:
status: In Progress → Fix Committed
Changed in ubuntu-sso-client:
status: Triaged → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers