Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2013-01-09 19:32:15 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2013-01-09 19:32:15 (GMT)
commit33d4064b7c3bfa6d001b397b3e563fd7f47792ac (patch)
tree174ebcf3233a6f508bd9fbd9519fc8f6e06cff5b
parent66e1d05224407280cb4ae20215ea2baca81db92b (diff)
Wait until the tree is populated
-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):