Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Conversation

@cpascual
Copy link
Member

@cpascual cpascual commented May 27, 2020

The test suite is still too fuzzy, and the py35-qt5 target had to be quarantined.

This PR does a large refactoring of the tests (mostly the taurus/qt ones) to improve the situation. With it, the testsuite seems finally stable for all the targets. As a summary, here is what changed:

  • refactor all the qt tests to use pytest-qt (this seemed to fix many of the "random" crashes during test execution). And deprecate old unittest-based qt test utilities and TimeOut DS.
  • force to use PyTango >=9.3.1 for all targets (I had to provide my own conda package of PyTango v9.3.1 which was not officially available, see ab6888b )
  • Add some pytest-based utilities for new tests
  • Fix a few bugs in the code that affect the tests (8efbe87 , 14d94b8, e48a2d9, dcb6831, )
  • Remove taurus usages of deprecated APIs of dependencies (1d44c7a, 46ddb2c, b5173ad, 964b18f, 6cb42ff, 4aaf110, 5bc24ad) and configure the tests to treat future occurrences as errors (66e4d32)
  • change the tango docker images to use a mirror from those of ska-docker to avoid availability issues of ska's registry

Also, this PR removes the allowed-to-fail tests (python2 ones and flake8) from travis matrix (to avoid wasting time). They can be run locally and/or re-enabled at any moment

Carlos Pascual added 4 commits May 25, 2020 19:18
Add a fixture for launching TangoSchemeTest for a test
Parameterizable pytest test for setting models sequentially
This is the Pytest equivalent to
GenericWidgetTestCase.test10_SetModelsSequentially
Implement a context manager to facilitate
checking deprecation errors in pytest tests
Leave only some relevant tests for quicker debugging
of py35-qt5 testing issues
@cpascual cpascual self-assigned this May 27, 2020
Carlos Pascual added 9 commits May 27, 2020 12:05
Re-enable test_form_itemFactory after refactoring it to
use the qtbot fixture from pytest-qt
Refactor (to use qtbot) and re-enable the following:
 - test_form_itemFactory_selection
 - test_form_cwidget_bck_compat
 - test_form_itemFactory_loading
Try to avoid problems with tango in atexit() by
forcing a previous unsubscribe in the test itself
- use cpascual conda forge (TEMPORARY)
- set minimum version in tox.ini
@cpascual cpascual added this to the Jul20 milestone Jun 2, 2020
Carlos Pascual added 12 commits June 3, 2020 13:19
py35-qt5
py36-qt5
py37-qt5
py37-ps2
Use pytest-qt and parameterize. Also avoid
segfaults in pyside2 tests due to PYSIDE-683 bug
The last refactoring introduced a failure in the last
paramterization of test_TaurusValueCombobox. Try to fix it
The introduction of pytest-qt triggered several hidden
issues in the PySide2 tests. Fix (or avoid) them
- Use pytest-qt
- Skip if using PySide2 (to avoid segfault)
The taurus.external.qt.QtCore shim simply aliases pyqtProperty
to Property when using the PySide2 binding. This produces
segfaults during exit of tests if Property is called with
the doc kwarg. Workaround by implementing pyqtProperty as a
wrapper of Property that avoids passing the doc kwarg.
TaurusGui.loadConfiguration fails if the QApplication is not
a TaurusApplication. This breaks the taurusgui test. Protect
against this case
Carlos Pascual added 16 commits June 9, 2020 20:51
Reimplement using pytest and pytest-qt. The skipped tests
are not ported.
Reimplement using pytest and pytest-qt.
Reimplement using pytest and pytest-qt.
Use pytest.mark.skipif instead of pytest.mark.skipIf
The *WidgetTestCase classes were created to help with
Qt tests based on unittest. Since we moved all the Qt
test to pytest-qt, we no longer want them (they
are less robust and don't play well with the pytest-qt
based tests)
Mark them as deprecated and skip any test based on them.
Remove last usages of taurus.qt.qtgui.test.base
in taurus code
TaurusLabel does not currently update its text when
updating the format. Fix this by forcing a
controllerUpdate() call whenever resetFormat is called.
This was likely the cause of some of the fuzzyness in
previous tests.
The "value" and "w_value" FgRoles do not raise
deprecation warnings. Adapt the tests accordingly
The test_class_format is fuzzy because not always
the format is reset (probably a race condition).
Force an explicit format reset to avoid it.
For some reason, the check_taurus_deprecations context manager
is not working ok when PySide2 is used via taurus.external.qt
(maybe it has to do with the installed log manager?)
As a workaround use xfail in these cases.
test_tauruslabel_text is not properly isolated and when it is called
with FgRole="quality" it fails in PySide2 if it has been previously
called with another FgRole.
Workaround this by moving it to the first position.
Since python3.6 we get DeprecationWarning
for invalid scape sequences. Fix them by
marking the string literals as "raw"
Thread.isAlive was deprecated in 2.7 and is
removed in 3.9/ Avoid it in our code
Since python3.3, Sequence and Mapping should be
imported from collections.abc instead of from
collections. Change code accordingly, keeping
bck-compat for python2.7
Use logging.warning instead
Ensure file is closed.
@cpascual cpascual changed the title [WIP] Fix test py3qt5 [WIP] Fix test suite Jun 11, 2020
Carlos Pascual added 3 commits June 12, 2020 18:37
AttributeTestCase.write_read_attribute() issues a pint warning.
Refactor it to avoid unnecessary downcasting of Quantities to
numpy arrays.
Usage of the VideoImageCodec raises the following deprecation
warning in py3:
"DeprecationWarning: The binary mode of fromstring is
deprecated, as it behaves surprisingly on unicode inputs.
Use frombuffer instead"
Replace fromstring -> frombuffer accordingly.
Ignore 3rd-party issued deprecation warnings and
treat all warnings issued by taurus as errors (tests should fail if
taurus emits a warning)
@cpascual cpascual changed the title [WIP] Fix test suite Fix test suite Jun 12, 2020
@cpascual
Copy link
Member Author

any @taurus-org/integrators daring to have a look at this PR? ;)
It would be nice to integrate it soon to unblock the road for the other changes needed for the Jul20 release

@cpascual cpascual mentioned this pull request Jun 15, 2020
3 tasks
@tiagocoutinho
Copy link

Ok, for what is worth I did an overview and it LGTM.

Also ran the tests locally (all except epics): Ran 565 tests in 6.247s

The CI likes it also go for it! Do you press the button or should I?

@cpascual
Copy link
Member Author

cpascual commented Jun 17, 2020

Thanks @tiagocoutinho !

Do you press the button or should I?

do the honors yourself!

@tiagocoutinho tiagocoutinho merged commit e3c9050 into taurus-org:develop Jun 17, 2020
@cpascual cpascual deleted the fix_test_py3qt5 branch June 18, 2020 14:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants