uitests: Handle slow app launch on fedora 39

Not quite sure what's going on here, I think it has something to
do with slowness when the accessibility bus is being polled.

Add some infrastructure to increase the timeout while we wait for
the app to pop up

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-03-03 10:17:02 -05:00
parent a05ab5cdb4
commit 0c899a7ccd
2 changed files with 28 additions and 1 deletions

View File

@ -347,6 +347,11 @@ class VMMDogtailApp(object):
if check_already_running:
self.error_if_already_running()
self._proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr)
if not will_fail:
if will_fail:
return
with utils.dogtail_timeout(10):
# On Fedora 39 sometimes app launch from the test suite
# takes a while for reasons I can't quite figure
self._root = dogtail.tree.root.application("virt-manager")
self._topwin = self.find_window(window_name)

View File

@ -3,6 +3,8 @@
import time
import dogtail.config
def check(func, timeout=2):
"""
@ -19,6 +21,26 @@ def check(func, timeout=2):
time.sleep(interval)
class dogtail_timeout:
"""
Context helper to run a specific check with custom timeout, in seconds
"""
def __init__(self, timeout):
backoff = dogtail.config.config.searchBackoffDuration
self._tmpval = int(timeout / backoff)
self._origval = dogtail.config.config.searchCutoffCount
def _set(self, val):
dogtail.config.config.searchCutoffCount = val
def __enter__(self):
self._set(self._tmpval)
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self._set(self._origval)
def walkUIList(app, win, lst, error_cb, reverse=False):
"""
Toggle down through a UI list like addhardware, net/storage/iface