This repository was archived by the owner on Mar 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Fix-365: Refactor TangoAttribute push_event #366
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Taurus4 introduced a regression related to the merge of TaurusAttribute and TaurusConfiguration. The TangoAttribute.push_event method handles all events but it doesn't do it properly for configuration-related error events received before the TangoAttribute has been initialized. In this situation, the TangoAttribute ends up flagged as subscribed but the subscription was not actually done, preventing to become properly subscribed when a non-error event comes later on. It also may incorrectly deactivate the polling mechanism. Refactor the push_event code to clean it and correctly handle conf errors.
Member
Author
|
Note that travis shows many failures in tests... they need to be investigated before accepting this PR |
Member
Author
|
Investigating the travis errors, with @sagiss ... It seems like they are (again) linked to #261, i.e., they are spurious failures, hard to reproduce outside travis. After forcing a re-run, we went from 8 errors to only 1: I am re-running it again in the hope that we get a clean build in travis to confirm that this is all #261 - related |
Collaborator
|
On docker cpascual/taurus-test (launching the taurustestsuite outside travis), I managed to reproduce the failures that were appearing before on Travis. root@taurus-test:/#
...
======================================================================
FAIL: test_write_read_attr_13 (taurus.core.tango.test.test_tangoattribute.AttributeTestCase)
Testing write_read_attr(attrname='short_scalar', expected={'warnings': [, ], 'wvalue': , 'rvalue': , 'data_format': 0, 'label': 'short_scalar', 'writable': True, 'range': [, ], 'alarms': [, ], 'type': 0}, expected_attrv={'w_value': 1000, 'quality': , 'value': 1000}, setvalue=)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/taurus/lib/taurus/test/base.py", line 113, in newTest
return helper(**helper_kwargs)
File "/home/taurus/lib/taurus/core/tango/test/test_tangoattribute.py", line 771, in write_read_attr
self.assertTrue(isinstance(read_value, TangoAttrValue), msg)
AssertionError: read() for "short_scalar" did not return a TangoAttrValue (got a NoneType)
======================================================================
FAIL: test_write_read_attr_16 (taurus.core.tango.test.test_tangoattribute.AttributeTestCase)
Testing write_read_attr(attrname='double_scalar', expected={'wvalue': , 'rvalue': , 'type': 1}, expected_attrv={'w_value': 3, 'quality': , 'value': 3}, setvalue=)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/taurus/lib/taurus/test/base.py", line 113, in newTest
return helper(**helper_kwargs)
File "/home/taurus/lib/taurus/core/tango/test/test_tangoattribute.py", line 771, in write_read_attr
self.assertTrue(isinstance(read_value, TangoAttrValue), msg)
AssertionError: read() for "double_scalar" did not return a TangoAttrValue (got a NoneType)
======================================================================
FAIL: test_write_read_attr_17 (taurus.core.tango.test.test_tangoattribute.AttributeTestCase)
Testing write_read_attr(attrname='double_scalar', expected={'wvalue': , 'rvalue': }, expected_attrv={'wvalue': , 'rvalue': , 'quality': }, setvalue=)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/taurus/lib/taurus/test/base.py", line 113, in newTest
return helper(**helper_kwargs)
File "/home/taurus/lib/taurus/core/tango/test/test_tangoattribute.py", line 771, in write_read_attr
self.assertTrue(isinstance(read_value, TangoAttrValue), msg)
AssertionError: read() for "double_scalar" did not return a TangoAttrValue (got a NoneType)
======================================================================
FAIL: test_write_read_attr_18 (taurus.core.tango.test.test_tangoattribute.AttributeTestCase)
Testing write_read_attr(attrname='double_scalar', expected={'alarms': [, ], 'range': [, ], 'name': 'double_scalar', 'warnings': [, ], 'wvalue': , 'rvalue': , 'type': 1}, expected_attrv={'wvalue': , 'w_value': 10, 'rvalue': , 'quality': , 'value': 10}, setvalue=)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/taurus/lib/taurus/test/base.py", line 113, in newTest
return helper(**helper_kwargs)
File "/home/taurus/lib/taurus/core/tango/test/test_tangoattribute.py", line 771, in write_read_attr
self.assertTrue(isinstance(read_value, TangoAttrValue), msg)
AssertionError: read() for "double_scalar" did not return a TangoAttrValue (got a NoneType)
======================================================================
FAIL: test_write_read_attr_19 (taurus.core.tango.test.test_tangoattribute.AttributeTestCase)
Testing write_read_attr(attrname='float_scalar', expected={'wvalue': , 'rvalue': , 'type': 1}, expected_attrv={'w_value': 3, 'quality': , 'value': 3}, setvalue=)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/taurus/lib/taurus/test/base.py", line 113, in newTest
return helper(**helper_kwargs)
File "/home/taurus/lib/taurus/core/tango/test/test_tangoattribute.py", line 771, in write_read_attr
self.assertTrue(isinstance(read_value, TangoAttrValue), msg)
AssertionError: read() for "float_scalar" did not return a TangoAttrValue (got a NoneType)
======================================================================
FAIL: test_write_read_attr_20 (taurus.core.tango.test.test_tangoattribute.AttributeTestCase)
Testing write_read_attr(attrname='float_scalar', expected={'wvalue': , 'rvalue': }, expected_attrv=': , 'rvalue': , 'quality': }, setvalue=)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/taurus/lib/taurus/test/base.py", line 113, in newTest
return helper(**helper_kwargs)
File "/home/taurus/lib/taurus/core/tango/test/test_tangoattribute.py", line 771, in write_read_attr
self.assertTrue(isinstance(read_value, TangoAttrValue), msg)
AssertionError: read() for "float_scalar" did not return a TangoAttrValue (got a NoneType)
======================================================================
FAIL: test_write_read_attr_21 (taurus.core.tango.test.test_tangoattribute.AttributeTestCase)
Testing write_read_attr(attrname='float_scalar', expected={'alarms': [, ], 'range': [, ], 'name': 'float_scalar', 'warnings': [, ],': , 'rvalue': , 'type': 1}, expected_attrv={'wvalue': , 'w_value': 10, : , 'quality': , 'value': 10}, setvalue=)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/taurus/lib/taurus/test/base.py", line 113, in newTest
return helper(**helper_kwargs)
File "/home/taurus/lib/taurus/core/tango/test/test_tangoattribute.py", line 771, in write_read_attr
self.assertTrue(isinstance(read_value, TangoAttrValue), msg)
AssertionError: read() for "float_scalar" did not return a TangoAttrValue (got a NoneType)
======================================================================
FAIL: test_write_read_attr_24 (taurus.core.tango.test.test_tangoattribute.AttributeTestCase)
Testing write_read_attr(attrname='boolean_scalar', expected={'writable': True, 'alarms': [None, None], 'range': [None, None], 'warnings': [None, None], ' False, 'rvalue': False, 'type': 3}, expected_attrv={'wvalue': False, 'w_value': False, 'rvalue': False, 'quality': , 'value': setvalue=False)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/taurus/lib/taurus/test/base.py", line 113, in newTest
return helper(**helper_kwargs)
File "/home/taurus/lib/taurus/core/tango/test/test_tangoattribute.py", line 771, in write_read_attr
self.assertTrue(isinstance(read_value, TangoAttrValue), msg)
AssertionError: read() for "boolean_scalar" did not return a TangoAttrValue (got a NoneType)
----------------------------------------------------------------------
Ran 560 tests in 79.258s
FAILED (failures=8, skipped=11)
|
The test-timer test is not deterministic. It may fail occasionally (e.g. if the machine is overloaded) cause testsuite failures that interfere with CI. Exclude this test in travis.
AttributeTestCase.write_read_attr helper uses attr.write(with_read=True) for reading the value. This may lead to reading None in some cases (e.g. attr.isUsingEvents() returns True) and cause the test to fail. Do separated write and read (without cache) instead.
BaseWidgetTestCase based tests make calls to QApplication.processEvents to emulate the Qt main loop. It seems that a single call is sometimes insufficient to process all needed events for the test, which causes spurious failures (see taurus-org#261) As a workaround, implement a BaseWidgetTestCase.processEvents method that loops several times over QApplication.processEvents and use it in the tests. Also remove previous workaround based on sleeps after setModel. Also re-enable skipped tauruslabel background tests since this fix seems to make them work again.
Some tests were commented out because they break test isolation. The fix of taurus-org#365 may have solved the root cause of this, so reenable them.
Some random test failures (see taurus-org#261) seem to be related to test DS not being properly initialized. Add a waiting time (controlled by the TAURUS_STARTER_WAIT env var) during starting of DS to alleviate this. Set TAURUS_STARTER_WAIT to 5 in Travis (i.e., wait 5 s after each DS start)
Member
Author
Member
Author
|
@cmft and me reviewed (and pair-programmed) this, so I am accepting the PR |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #365. (and also fix #261 as a side-effect)
Taurus4 introduced a regression related to the merge of TaurusAttribute
and TaurusConfiguration. The TangoAttribute.push_event method handles
all events but it doesn't do it properly for configuration-related
error events received before the TangoAttribute has been initialized.
In this situation, the TangoAttribute ends up flagged as subscribed
but the subscription was not actually done, preventing to become
properly subscribed when a non-error event comes later on.
It also may incorrectly deactivate the polling mechanism.
Refactor the push_event code to clean it and correctly handle conf
errors.
Notes:
As part of the review and integration of this change, we needed to deal
with the spurious failures in travis (Random failures in testsuite (workaround exists, but proper fix is pending) #261 ). This PR also makes the testsuite
more robust (not infalible, though). It is enough IMHO to Fix Random failures in testsuite (workaround exists, but proper fix is pending) #261.
this seems to solve the issue with the Sardana server reported in:
https://sourceforge.net/p/sardana/mailman/message/35591825/
(we tried with this change, with sardana from develop and the tango9 stack
from debian9 repos... and we successfully ran sar_demo using a single
Sardana instance)