[jhbuild/desktop-testing: 1/6] [ldtp] Add module for shared code (utils/ldtp.py)



commit b65632d112eecc97190c6d30697d0e6dc2bd1ab4
Author: John Carr <john carr unrouted co uk>
Date:   Mon May 18 22:16:41 2009 +0100

    [ldtp] Add module for shared code (utils/ldtp.py)
---
 jhbuild/utils/ldtp.py |   58 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/jhbuild/utils/ldtp.py b/jhbuild/utils/ldtp.py
new file mode 100644
index 0000000..9ee93d1
--- /dev/null
+++ b/jhbuild/utils/ldtp.py
@@ -0,0 +1,58 @@
+# jhbuild - a build script for GNOME 1.x and 2.x
+# Copyright (C) 2009  Codethink Ltd.
+#
+#   ldtp.py: Helper methods for running LDTP/gnome-desktop-testing tests
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#  Authors:
+#    John Carr <john carr unrouted co uk>
+
+__all__ = [
+    'get_ldtp_helper',
+]
+
+
+class LDTPHelper(object):
+    """
+    Helper object for running gnome-destop-testing tests
+    """
+
+    def __init__(self, application=None):
+        self.application = application
+
+    def execute(self, buildscript):
+        testargs = ['desktop-testing']
+
+        if self.application:
+            testargs.extend(['-a', self.application])
+
+        buildscript.execute(testargs)
+
+
+def get_ldtp_helper(node):
+    app = node.getAttribute("id")
+
+    for child in node.childNodes:
+        if child.nodeType == child.ELEMENT_NODE and child.nodeName == 'ldtp':
+            break
+    else:
+        return None
+
+    if child.hasAttribute("application"):
+        app = ldtpnode.getAttribute("application")
+
+    return LDTPHelper(app)
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]