enthought / enthought/traitsui
UITester delay fail with AttributeError upon mouse clicking buttons on PySide2
- Dominant language
- Python
- Stars
- 306
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
If I change this line:
https://github.com/enthought/traitsui/blob/a2ad46405b5d876ff098bcc978371ab5e8855e8d/traitsui/examples/demo/Standard_Editors/tests/test_BooleanEditor_demo.py#L29
to
```
tester = UITester(delay=100) # or any positive integer
```
And if the Qt backend is PySide2, one gets the following error:
```
Traceback (most recent call last):
File "/Users/kchoi/Work/ETS/traitsui/traitsui/examples/demo/Standard_Editors/tests/test_BooleanEditor_demo.py", line 36, in test_boolean_editor_demo
simple.perform(MouseClick())
File "/Users/kchoi/Work/ETS/py39-venv/traitsui-env/lib/python3.9/site-packages/traitsui/testing/tester/ui_wrapper.py", line 244, in perform
self._perform_or_inspect(interaction)
File "/Users/kchoi/Work/ETS/py39-venv/traitsui-env/lib/python3.9/site-packages/traitsui/testing/tester/ui_wrapper.py", line 310, in _perform_or_inspect
return handler(self, interaction)
File "/Users/kchoi/Work/ETS/py39-venv/traitsui-env/lib/python3.9/site-packages/traitsui/testing/tester/_ui_tester_registry/qt4/_traitsui/boolean_editor.py", line 32, in
handler=lambda wrapper, _: _interaction_helpers.mouse_click_qwidget(
File "/Users/kchoi/Work/ETS/py39-venv/traitsui-env/lib/python3.9/site-packages/traitsui/testing/tester/_ui_tester_registry/qt4/_interaction_helpers.py", line 116, in mouse_click_qwidget
QTest.qSleep(delay)
AttributeError: type object 'PySide2.QtTest.QTest' has no attribute 'qSleep'
```
Apparently `qSleep` is not exposed by PySide2, but it is exposed by PyQt5.
It might need to be changed to `time.sleep` afterall.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.