2008-09-25 Mark Doffman <mark.doffman@codethink.co.uk>
authorMark Doffman <mdoff@silver-wind.(none)>
Tue, 30 Sep 2008 01:32:23 +0000 (02:32 +0100)
committerMark Doffman <mdoff@silver-wind.(none)>
Tue, 30 Sep 2008 01:32:23 +0000 (02:32 +0100)
* tests/Makefile.am
  configure.ac
  For the moment remove the cspi tests. cspi
  needs modification for it to be in working order again.

* tests/pyatspi/*
  Add unit tests to 'make check'

13 files changed:
configure.ac
pyatspi/Makefile.am
tests/Makefile.am
tests/pyatspi/Makefile.am
tests/pyatspi/accessibletest.py
tests/pyatspi/actiontest.py
tests/pyatspi/componenttest.py
tests/pyatspi/desktoptest.py
tests/pyatspi/relationtest.py
tests/pyatspi/runtests.sh [new file with mode: 0755]
tests/pyatspi/setvars.sh [changed mode: 0755->0644]
tests/pyatspi/testrunner [new file with mode: 0755]
tests/pyatspi/testrunner.py [deleted file]

index 371c33f5d961836c23091c4889add1abf908cc1d..024906417053b9890edb231680713806c64cc2dd 100644 (file)
@@ -190,7 +190,6 @@ AC_CONFIG_FILES([Makefile
                 atk-adaptor/Makefile
                 login-helper/Makefile
                 tests/dummyatk/Makefile
-                tests/cspi/Makefile
                 tests/data/Makefile
                 tests/pyatspi/Makefile
                 tests/pyatspi/pasytest/Makefile
index 3979bbcba236759f4dd46674f9e258fe052808e6..c204ab443c87dc27e4ef44b79654020a0fb10727 100644 (file)
@@ -1,4 +1,6 @@
+pyatspidir = $(pythondir)/pyatspi
 pyatspi_PYTHON = \
+               Accessibility.py        \
                accessible.py           \
                action.py               \
                application.py          \
@@ -31,6 +33,4 @@ pyatspi_PYTHON = \
                utils.py                \
                value.py
 
-pyatspidir=$(pyexecdir)/pyatspi
-
 CLEANFILES = *.pyc
index 239fd4bde1edaadc0a105d88bc904e0b22cd7016..10d902b350efe64591fbfd6e7a2445d861f97b02 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = dummyatk apps data cspi pyatspi
+SUBDIRS = dummyatk apps data pyatspi
 
 #TESTS=testrunner.py
 TESTS_ENVIRONMENT = PYTHONPATH=$(abs_top_srcdir)/python                                        \
index dbe32a8bc12d99ea85e7054fa48b3e6e042748f5..97213ce92edb532692ff1e5457c2e9db42c72cf4 100644 (file)
@@ -2,6 +2,7 @@ SUBDIRS = pasytest
 
 EXTRA_DIST = \
        accessibletest.py\
+       actiontest.py\
        componenttest.py\
        desktoptest.py\
        statetest.py\
@@ -9,6 +10,11 @@ EXTRA_DIST = \
        Makefile.in\
        setvars.sh\
        relationtest.py\
-       testrunner.py
+       runtests.sh\
+       testrunner
+
+TESTS_ENVIRONMENT = top_builddir=$(top_builddir) top_srcdir=$(top_srcdir)
+
+TESTS = runtests.sh
 
 CLEANFILES = *.pyc
index 3867883af5f596fff1dea84e0cef714f555d41d6..d94e0af7b9d034e5b4c12ea29679463b1ec3d6d0 100644 (file)
@@ -55,7 +55,8 @@ class AccessibleTest(_PasyTest):
                self._path = path
 
        def setup(self, test):
-               self._registry = pyatspi.registry.Registry(self._path)
+               self._registry = pyatspi.Registry()
+               print self._path
                self._desktop = self._registry.getDesktop(0)
 
        def test_name(self, test):
index 870bf195d1ce77700cbfb2842c1612d937d8c758..405f898c1df26bf3e495021f5a5e72dd56084415 100644 (file)
@@ -26,7 +26,7 @@ class ActionTest(_PasyTest):
                self._path = path
 
        def setup(self, test):
-               self._registry = pyatspi.registry.Registry(self._path)
+               self._registry = pyatspi.Registry()
                self._desktop = self._registry.getDesktop(0)
 
        def test_nActions(self, test):
index 28a66f3558d1a76a10b021d761a344e9646a0de1..c6a9253804254b1817a4aafb11e3538308beef7e 100644 (file)
@@ -44,7 +44,7 @@ class ComponentTest(_PasyTest):
                self._path = path
 
        def setup(self, test):
-               self._registry = pyatspi.registry.Registry(self._path)
+               self._registry = pyatspi.Registry()
                self._desktop = self._registry.getDesktop(0)
 
        def test_contains(self, test):
index 8266220fa97dff8164995bc442f1f6d751ef50fb..409f634d0918a359a6d0550ed1634390d2ede245 100644 (file)
@@ -46,7 +46,7 @@ class DesktopTest(_PasyTest):
                self._path = path
 
        def setup(self, test):
-               self._registry = pyatspi.registry.Registry(self._path)
+               self._registry = pyatspi.Registry()
                self._desktop = self._registry.getDesktop(0)
 
        def test_name(self, test):
index 6f93b1448d3d2d684309747e27f0d24653d58df7..77ce31ca89d71d37759c86b898fb84dcd4a005c8 100644 (file)
@@ -25,7 +25,7 @@ class RelationTest(_PasyTest):
                self._path = path
 
        def setup(self, test):
-               self._registry = pyatspi.registry.Registry(self._path)
+               self._registry = pyatspi.Registry()
                self._desktop = self._registry.getDesktop(0)
                self._root = self._desktop[0]
                self._rset = self._root.getRelationSet()
diff --git a/tests/pyatspi/runtests.sh b/tests/pyatspi/runtests.sh
new file mode 100755 (executable)
index 0000000..eec34d9
--- /dev/null
@@ -0,0 +1,12 @@
+export PYTHONPATH=$top_srcdir
+
+export TEST_DATA_DIRECTORY=$top_srcdir/tests/data
+export TEST_ATSPI_LIBRARY=$top_builddir/atk-adaptor/.libs/libspiatk.so
+export TEST_MODULES_DIRECTORY=$top_builddir/tests/apps/.libs
+export TEST_APPLICATION=$top_builddir/tests/apps/test-application
+
+$top_srcdir/tests/pyatspi/testrunner -l libaccessibleapp.so -m accessibletest -n AccessibleTest
+$top_srcdir/tests/pyatspi/testrunner -l libactionapp.so -m actiontest -n ActionTest
+$top_srcdir/tests/pyatspi/testrunner -l libcomponentapp.so -m componenttest -n ComponentTest
+$top_srcdir/tests/pyatspi/testrunner -l librelationapp.so -m relationtest -n RelationTest
+$top_srcdir/tests/pyatspi/testrunner -l libaccessibleapp.so -m statetest -n StateTest
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/tests/pyatspi/testrunner b/tests/pyatspi/testrunner
new file mode 100755 (executable)
index 0000000..92531e2
--- /dev/null
@@ -0,0 +1,94 @@
+#!/usr/bin/python
+
+import gobject
+import dbus
+import sys
+import os
+import time
+from random import randint
+
+from optparse import OptionParser
+from pasytest import PasyTest
+
+from dbus.mainloop.glib import DBusGMainLoop
+
+DBusGMainLoop(set_as_default=True)
+
+def run_test_app(module_name, dbus_name=None, wait_for_debug=False):
+       import os
+       from subprocess import Popen
+
+       test_data_directory = os.environ["TEST_DATA_DIRECTORY"]
+       test_modules_directory = os.environ["TEST_MODULES_DIRECTORY"]
+       test_atspi_library = os.environ["TEST_ATSPI_LIBRARY"]
+       test_application = os.environ["TEST_APPLICATION"]
+
+       test_module = os.path.join(test_modules_directory, module_name)
+
+       if (dbus_name):
+               print " ".join([test_application,
+                       "--atspi-dbus-name", dbus_name,
+                       "--test-atspi-library", test_atspi_library,
+                       "--test-module", test_module,
+                       "--test-data-directory", test_data_directory,])
+               pop = Popen([test_application,
+                       "--atspi-dbus-name", dbus_name,
+                       "--test-atspi-library", test_atspi_library,
+                       "--test-module", test_module,
+                       "--test-data-directory", test_data_directory,])
+       else:
+               print " ".join([test_application,
+                       "--test-atspi-library", test_atspi_library,
+                       "--test-module", test_module,
+                       "--test-data-directory", test_data_directory,])
+               pop = Popen([test_application,
+                       "--test-atspi-library", test_atspi_library,
+                       "--test-module", test_module,
+                       "--test-data-directory", test_data_directory,])
+
+       wait_message = """
+       The test application %s has been started with PID %d.
+       
+       To continue the test press ENTER.\n\n
+       """
+       if (wait_for_debug):
+               raw_input(wait_message % (module_name, pop.pid))
+
+def main(argv):
+       parser = OptionParser()
+       parser.add_option("-l", "--library", dest="test_library")
+       parser.add_option("-m", "--module", dest="test_module")
+       parser.add_option("-n", "--name", dest="test_name")
+       parser.add_option("-w", "--wait", action="store_true", dest="wait", default=False)
+       (options, args) = parser.parse_args()
+
+       bus = dbus.SessionBus()
+       name = "test.atspi.R" + str(randint(1, 1000)) 
+
+       app = run_test_app(options.test_library, name, wait_for_debug=options.wait)
+       time.sleep(1)
+       print "Started test app on bus name %s" % (name,)
+
+       to = bus.get_object(name, "/org/codethink/atspi/test")
+       test = dbus.Interface(to, "org.codethink.atspi.test")
+
+       # Run the test script here
+       os.environ["ATSPI_TEST_APP_NAME"] = name
+       module = __import__(options.test_module)
+       test_class = getattr(module, options.test_name)
+       test_object = test_class(bus, name)
+       test_object.run()
+
+       loop = gobject.MainLoop()
+
+       def finished_handler():
+               loop.quit()
+               print "\n" + test_object.report() + "\n"
+               test.finish()
+
+       test_object.events.finished += finished_handler
+
+       loop.run()
+
+if __name__=="__main__":
+       sys.exit(main(sys.argv))
diff --git a/tests/pyatspi/testrunner.py b/tests/pyatspi/testrunner.py
deleted file mode 100755 (executable)
index b74929e..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/python
-
-import gobject
-import dbus
-import sys
-import time
-from random import randint
-
-from optparse import OptionParser
-from pasytest import PasyTest
-
-from dbus.mainloop.glib import DBusGMainLoop
-
-DBusGMainLoop(set_as_default=True)
-
-def run_test_app(module_name, dbus_name=None, wait_for_debug=False):
-       import os
-       from subprocess import Popen
-
-       test_data_directory = os.environ["TEST_DATA_DIRECTORY"]
-       test_modules_directory = os.environ["TEST_MODULES_DIRECTORY"]
-       test_atspi_library = os.environ["TEST_ATSPI_LIBRARY"]
-       test_application = os.environ["TEST_APPLICATION"]
-
-       test_module = os.path.join(test_modules_directory, module_name)
-
-       if (dbus_name):
-               print " ".join([test_application,
-                       "--atspi-dbus-name", dbus_name,
-                       "--test-atspi-library", test_atspi_library,
-                       "--test-module", test_module,
-                       "--test-data-directory", test_data_directory,])
-               pop = Popen([test_application,
-                       "--atspi-dbus-name", dbus_name,
-                       "--test-atspi-library", test_atspi_library,
-                       "--test-module", test_module,
-                       "--test-data-directory", test_data_directory,])
-       else:
-               print " ".join([test_application,
-                       "--test-atspi-library", test_atspi_library,
-                       "--test-module", test_module,
-                       "--test-data-directory", test_data_directory,])
-               pop = Popen([test_application,
-                       "--test-atspi-library", test_atspi_library,
-                       "--test-module", test_module,
-                       "--test-data-directory", test_data_directory,])
-
-       wait_message = """
-       The test application %s has been started with PID %d.
-       
-       To continue the test press ENTER.\n\n
-       """
-       if (wait_for_debug):
-               raw_input(wait_message % (module_name, pop.pid))
-
-def main(argv):
-       parser = OptionParser()
-       parser.add_option("-l", "--library", dest="test_library")
-       parser.add_option("-m", "--module", dest="test_module")
-       parser.add_option("-n", "--name", dest="test_name")
-       parser.add_option("-w", "--wait", action="store_true", dest="wait", default=False)
-       (options, args) = parser.parse_args()
-
-       bus = dbus.SessionBus()
-       name = "test.atspi.R" + str(randint(1, 1000)) 
-
-       app = run_test_app(options.test_library, name, wait_for_debug=options.wait)
-       time.sleep(1)
-       print "Started test app on bus name %s" % (name,)
-
-       to = bus.get_object(name, "/org/codethink/atspi/test")
-       test = dbus.Interface(to, "org.codethink.atspi.test")
-
-       # Run the test script here
-       module = __import__(options.test_module)
-       test_class = getattr(module, options.test_name)
-       test_object = test_class(bus, name)
-       test_object.run()
-
-       loop = gobject.MainLoop()
-
-       def finished_handler():
-               loop.quit()
-               print "\n" + test_object.report() + "\n"
-               test.finish()
-
-       test_object.events.finished += finished_handler
-
-       loop.run()
-
-if __name__=="__main__":
-       sys.exit(main(sys.argv))