Menu

#334 Random failures in testsuite (workaround exists, but proper fix is pending)

Jan17
waiting
None
bug
2016-08-29
2016-08-24
No

The testsuite is not robust.
Running the taurus testsuite sometimes results in "spurious" failures. This tends to affect more the Travis builds (although it also happens -less frequently- when using the taurus-test docker locally ) and , with even less frequency when running the tests directly in my desktop.

In the case of travis builds, the spurious failures occur almost on every build of the develop branch, which makes it very difficult for CI.

The failures are quite random, although they seem always related with some kind of race condition when access to tango is involved. See, e.g.:

The following changes seem to alleviate the problem for the taurus.qt tests:

diff --git a/lib/taurus/qt/qtgui/base/test/test_taurusbase.py b/lib/taurus/qt/qtgui/base/test/test_taurusbase.py
index 3c6c915..66c9521 100644
--- a/lib/taurus/qt/qtgui/base/test/test_taurusbase.py
+++ b/lib/taurus/qt/qtgui/base/test/test_taurusbase.py
@@ -94,6 +94,8 @@ class GetDisplayValueTestCase(TangoSchemeTestLauncher, BaseWidgetTestCase,
     def getDisplayValue(self, model=None, expected=None):
         '''Check if setModel works when using parent model'''
         self._widget.setModel(model)
+        import time
+        time.sleep(1)
         got = self._widget.getDisplayValue()
         msg = ('getDisplayValue for "%s" should be %r (got %r)' %
                (model, expected, got))
diff --git a/lib/taurus/qt/qtgui/test/base.py b/lib/taurus/qt/qtgui/test/base.py
index 2fff74c..9e66221 100644
--- a/lib/taurus/qt/qtgui/test/base.py
+++ b/lib/taurus/qt/qtgui/test/base.py
@@ -69,6 +69,8 @@ class BaseWidgetTestCase(object):

         if self._klass is not None:
             self._widget = self._klass(*self.initargs, **self.initkwargs)
+        import time
+        time.sleep(1)

     def assertMaxDeprecations(self, maximum, msg=None):
         """Assertion method that checks that the number of deprecations issued

Related

OLD Tickets: #335

Discussion

  • Carlos Pascual

    Carlos Pascual - 2016-08-25

    Solutions are being tested in https://github.com/cpascual/taurus/pull/32

     
  • Carlos Pascual

    Carlos Pascual - 2016-08-29
    • status: active --> waiting
     
  • Carlos Pascual

    Carlos Pascual - 2016-08-29

    The workarounds suggested in https://github.com/cpascual/taurus/pull/32 seem to make the testsuite usable again (it does not fix the problem, which seems to be related to poor isolation between tests involving launching the TangoSchemeTest DS).

    Note that the fact that the use of sleep() alleviates the problem suggests that some event may not have time to reach its destination in time...

    We will apply the workaround, but leave this bug open until a proper solution is found.

     

    Last edit: Carlos Pascual 2016-08-29
  • Carlos Pascual

    Carlos Pascual - 2016-08-29
    • summary: Random failures in testsuite --> Random failures in testsuite (workaround exists, but proper fix is pending)
     
  • Zbigniew Reszela

     
  • Zbigniew Reszela

    The pull request with the workaround was integrated in the develop branch.