diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sugar/shell.py | 8 | ||||
-rw-r--r-- | tests/sugar/tree.py | 12 |
2 files changed, 13 insertions, 7 deletions
diff --git a/tests/sugar/shell.py b/tests/sugar/shell.py index 515f98e..33917a9 100644 --- a/tests/sugar/shell.py +++ b/tests/sugar/shell.py @@ -1,6 +1,7 @@ import logging import sys import time +import traceback import tree @@ -83,4 +84,9 @@ def main(): for activity in build_activities_list(): launch_and_stop_activity(activity) -main() +try: + main() +except: + logging.error(traceback.format_exc()) + logging.error("\n%s" % tree.get_root().dump()) + raise diff --git a/tests/sugar/tree.py b/tests/sugar/tree.py index 6a12abc..19206e2 100644 --- a/tests/sugar/tree.py +++ b/tests/sugar/tree.py @@ -30,8 +30,6 @@ def _retry_find(func): time.sleep(5) n_retries = n_retries + 1 - get_root().dump() - return result return wrapped @@ -42,7 +40,9 @@ class Node: self._accessible = accessible def dump(self): - self._crawl_accessible(self, 0) + lines = [] + self._crawl_accessible(self, 0, lines) + return "\n".join(lines) def do_action(self, name): for i in range(self._accessible.get_n_actions()): @@ -130,8 +130,8 @@ class Node: for child in node.get_children(): self._find_all_descendants(child, predicate, matches) - def _crawl_accessible(self, node, depth): - print " " * depth + str(node) + def _crawl_accessible(self, node, depth, lines): + lines.append(" " * depth + str(node)) for child in node.get_children(): - self._crawl_accessible(child, depth + 1) + self._crawl_accessible(child, depth + 1, lines) |