From: Simon McVittie Date: Fri, 7 Jul 2017 11:12:24 +0000 (+0100) Subject: test/name-test: Be compatible with Python 3 X-Git-Tag: dbus-1.10.22~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ace54f13587e13ea2ebafb6127fcb47a2c2c22ac;p=thirdparty%2Fdbus.git test/name-test: Be compatible with Python 3 configure.ac will detect PYTHON=python3 if there is no python executable in the PATH. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101716 Reviewed-by: Philip Withnall Signed-off-by: Simon McVittie --- diff --git a/test/name-test/test-activation-forking.py b/test/name-test/test-activation-forking.py index f98537eb6..44bc1a6e5 100644 --- a/test/name-test/test-activation-forking.py +++ b/test/name-test/test-activation-forking.py @@ -7,7 +7,7 @@ try: import dbus import dbus.mainloop.glib except: - print "Failed import, aborting test" + print("Failed import, aborting test") sys.exit(0) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) @@ -23,7 +23,7 @@ i = dbus.Interface(o, 'org.freedesktop.TestSuite') # Start it up reply = i.Echo("hello world") -print "TestSuiteForkingEchoService initial reply OK" +print("TestSuiteForkingEchoService initial reply OK") def ignore(*args, **kwargs): pass @@ -36,7 +36,7 @@ def on_forking_echo_owner_changed(name, old, new): global o global i if counter > 10: - print "Activated 10 times OK, TestSuiteForkingEchoService pass" + print("Activated 10 times OK, TestSuiteForkingEchoService pass") loop.quit() return counter += 1 @@ -52,7 +52,7 @@ i.Exit(reply_handler=ignore, error_handler=ignore) def check_counter(): if counter == 0: - print "Failed to get NameOwnerChanged for TestSuiteForkingEchoService" + print("Failed to get NameOwnerChanged for TestSuiteForkingEchoService") sys.exit(1) GObject.timeout_add(15000, check_counter) diff --git a/test/name-test/test-wait-for-echo.py b/test/name-test/test-wait-for-echo.py index 49ecbb461..d1b9e0c4d 100755 --- a/test/name-test/test-wait-for-echo.py +++ b/test/name-test/test-wait-for-echo.py @@ -7,7 +7,7 @@ try: import dbus.mainloop.glib from gi.repository import GObject except: - print "Failed import, aborting test" + print("Failed import, aborting test") sys.exit(0) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) @@ -16,7 +16,7 @@ loop = GObject.MainLoop() exitcode = 0 def handle_noreceipt(): - print "Failed to get signal" + print("Failed to get signal") global exitcode exitcode = 1 loop.quit() @@ -26,7 +26,7 @@ GObject.timeout_add(7000, handle_noreceipt) bus = dbus.SessionBus() def sighandler(*args, **kwargs): - print "got signal" + print("got signal") loop.quit() bus.add_signal_receiver(sighandler, dbus_interface='org.freedesktop.TestSuite', signal_name='Foo')