enthought / enthought/traitsui
UITester does not interact well with GuiTestAssistant in Python 3.8
- Dominant language
- Python
- Stars
- 306
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
An issue was observed when using `UITester` with `GuiTestAssistant.assertEventuallyTrueInGui` in Python 3.8. The issue cannot be reproduced in python 3.6. For the test the following packages were used:
- traitsui 7.4.0
- pyface 7.4.2
- pyside6 6.3.2
There is a sample code that can reproduce the error (taken from traitsui/tests/editors/test_table_editor.py line 512):
```
class TestTableEditor(BaseTestMixin, GuiTestAssistant, unittest.TestCase):
def setUp(self):
BaseTestMixin.setUp(self)
GuiTestAssistant.setUp(self)
def tearDown(self):
BaseTestMixin.tearDown(self)
GuiTestAssistant.tearDown(self)
def test_table_editor_check_display_with_tester(self):
object_list = ObjectListWithSelection(
values=[ListItem(other_value=0)]
)
tester = UITester()
with tester.create_ui(object_list, dict(view=select_row_view)) as ui:
self.assertEventuallyTrueInGui(lambda: True)
wrapper = tester.find_by_name(ui, "values").locate(Cell(0, 1))
actual = wrapper.inspect(DisplayedText())
self.assertEqual(actual, "0")
object_list.values[0].other_value = 123
actual = wrapper.inspect(DisplayedText())
self.assertEqual(actual, "123")
```
Note that if you remove the line `self.assertEventuallyTrueInGui(lambda: True)` then the test works fine. When you leave it then you get an error on the following line: `ValueError: No editors can be found with name 'values'. Found these: []`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.