diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2005-08-25 00:20:41 +0000 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2005-08-25 00:20:41 +0000 |
commit | 781b0cdef9d2091a055aa2fc0a36e24bee25966d (patch) | |
tree | 9c8a8b8cb2e9edf1895c25e6ec411784b15a43e3 /test/python/test-service.py | |
parent | 329ac511e9fec88df27b07d31a532d7826516f30 (diff) |
* test/python: Add python regression test
* configure.in: Add test/python/Makefile
* test/Makefile.am: Add the python directory to SUBDIRS
Diffstat (limited to 'test/python/test-service.py')
-rwxr-xr-x | test/python/test-service.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/python/test-service.py b/test/python/test-service.py new file mode 100755 index 00000000..21d101ce --- /dev/null +++ b/test/python/test-service.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +import sys +import os + +builddir = os.environ["DBUS_TOP_BUILDDIR"] +pydir = builddir + "/python" + +sys.path.insert(0, pydir) + +import dbus + +if not dbus.__file__.startswith(pydir): + raise Exception("DBus modules are not being picked up from the package") + +import dbus.service +import dbus.glib +import gobject + +class TestObject(dbus.service.Object): + def __init__(self, bus_name, object_path="/org/freedesktop/DBus/TestSuitePythonObject"): + dbus.service.Object.__init__(self, bus_name, object_path) + + """ Echo whatever is sent + """ + @dbus.service.method("org.freedesktop.DBus.TestSuiteInterface") + def Echo(self, arg): + return arg + +session_bus = dbus.SessionBus() +name = dbus.service.BusName("org.freedesktop.DBus.TestSuitePythonService", bus=session_bus) +object = TestObject(name) + +loop = gobject.MainLoop() +loop.run() |