Tests from test_share_links_search are causing timing issues with QThread

Bug #1066894 reported by Diego Sarmentero
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu One Control Panel
Status tracked in Trunk
Stable-4-2
Fix Released
Undecided
Unassigned
Trunk
Fix Released
Undecided
Diego Sarmentero

Bug Description

The start method from QThread is not being patched properly and this is causing a race condition because some part of the test is running as a thread.

In one of my computers (Mac, which is slower) i'm getting this:

[FAIL]
Traceback (most recent call last):
  File "/Users/gatox/canonical/build-env/scripts/devsetup/parts/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py", line 221, in test_filter
    self.assertEqual(expected, self.ui.temp_u1_files)
  File "/Users/gatox/canonical/build-env/scripts/devsetup/eggs/Twisted-11.1.0-py2.7-macosx-10.4-x86_64.egg/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = ['~/blabla/iop']
b = []

ubuntuone.controlpanel.gui.qt.tests.test_share_links_search.SearchBoxTestCase.test_filter
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/Users/gatox/canonical/build-env/scripts/devsetup/parts/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py", line 108, in test_key_down_pressed_load_more_items
    self.assertEqual(self.ui.popup.list_widget.count(), 20)
  File "/Users/gatox/canonical/build-env/scripts/devsetup/eggs/Twisted-11.1.0-py2.7-macosx-10.4-x86_64.egg/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = 0
b = 20

ubuntuone.controlpanel.gui.qt.tests.test_share_links_search.SearchBoxTestCase.test_key_down_pressed_load_more_items
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/Users/gatox/canonical/build-env/scripts/devsetup/parts/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py", line 132, in test_key_up_pressed_stay_in_0
    self.assertEqual(self.ui.popup.list_widget.currentRow(), 0)
  File "/Users/gatox/canonical/build-env/scripts/devsetup/eggs/Twisted-11.1.0-py2.7-macosx-10.4-x86_64.egg/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = -1
b = 0

ubuntuone.controlpanel.gui.qt.tests.test_share_links_search.SearchBoxTestCase.test_key_up_pressed_stay_in_0
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/Users/gatox/canonical/build-env/scripts/devsetup/parts/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py", line 206, in test_process_volumes_info
    self.assertEqual(self.ui._thread_explore.u1_files, expected)
  File "/Users/gatox/canonical/build-env/scripts/devsetup/eggs/Twisted-11.1.0-py2.7-macosx-10.4-x86_64.egg/twisted/trial/unittest.py", line 270, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = []
b = ['other_path/test/qwe',
 '~/blabla/iop',
 '~/one/file3',
 '~/test/asd',
 '~/ubuntu/file1',
 '~/ubuntu/file2']

ubuntuone.controlpanel.gui.qt.tests.test_share_links_search.SearchBoxTestCase.test_process_volumes_info
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/Users/gatox/canonical/build-env/scripts/devsetup/parts/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py", line 144, in test_key_return_pressed
    self.ui._key_return_pressed(current)
  File "/Users/gatox/canonical/build-env/scripts/devsetup/parts/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/share_links_search.py", line 186, in _key_return_pressed
    self._set_selected_item(item)
  File "/Users/gatox/canonical/build-env/scripts/devsetup/parts/ubuntuone-control-panel/ubuntuone/controlpanel/gui/qt/share_links_search.py", line 205, in _set_selected_item
    self.itemSelected.emit(widget.file_path)
exceptions.AttributeError: 'NoneType' object has no attribute 'file_path'

ubuntuone.controlpanel.gui.qt.tests.test_share_links_search.SearchBoxTestCase.test_key_return_pressed
-------------------------------------------------------------------------------
Ran 1254 tests in 83.117s

FAILED (skips=1, failures=4, errors=1, successes=1248)

This is because the start() function of the QThread is executed in the initialization of the object before these method is patched properly.

Related branches

description: updated
Changed in ubuntuone-control-panel:
status: In Progress → Fix Committed
dobey (dobey)
Changed in ubuntuone-control-panel:
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.