Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/sugar/shell.py2
-rw-r--r--tests/sugar/tree.py18
2 files changed, 17 insertions, 3 deletions
diff --git a/tests/sugar/shell.py b/tests/sugar/shell.py
index 33917a9..b6180a6 100644
--- a/tests/sugar/shell.py
+++ b/tests/sugar/shell.py
@@ -88,5 +88,5 @@ try:
main()
except:
logging.error(traceback.format_exc())
- logging.error("\n%s" % tree.get_root().dump())
+ logging.error("\n%s" % tree.get_root(wait=False).dump())
raise
diff --git a/tests/sugar/tree.py b/tests/sugar/tree.py
index 1a58277..6607371 100644
--- a/tests/sugar/tree.py
+++ b/tests/sugar/tree.py
@@ -7,8 +7,22 @@ from gi.repository import GLib
Atspi.set_timeout(-1, -1)
-def get_root():
- return Node(Atspi.get_desktop(0))
+def get_root(wait=True):
+ desktop = Node(Atspi.get_desktop(0))
+
+ if not wait:
+ return desktop
+
+ n_tries = 0
+ while n_tries < 50:
+ if desktop.get_children():
+ return desktop
+
+ n_tries = n_tries + 1
+ logging.info("Waiting for a valid accessibility tree %d" % n_tries)
+ time.sleep(1)
+
+ return None
def _retry_find(func):