Possible GuiTestAssistant API Changes
- Dominant language
- Python
- Stars
- 115
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
The use of context managers in the `GuiTestAssistant` is somewhat misleading, since in most cases the event loop is run in the `__exit__` phase. So when a test writer writes something like:
```
with self.event_loop_until_traits_change(obj, 'foo'):
obj.foo = 'bar'
```
it appears at first glance like the trait setting is happening while the event loop is running, when in fact the trait is being set before the event loop starts (but after the event listeners have been connected).
A clearer pattern would be:
```
# do set-up in preparation for event loop, including setting up timers/deferred calls
...
# run the event loop
self.event_loop_until_traits_change(obj, 'foo')
# check that everything is OK
...
```
The best way to implement this is probably via new methods rather than breaking old methods.
Another improvement would be to use toolkit-independent API calls for things like timers and starting/stopping event loops.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.