From ace54f13587e13ea2ebafb6127fcb47a2c2c22ac Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 7 Jul 2017 12:12:24 +0100 Subject: [PATCH] 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 --- test/name-test/test-activation-forking.py | 8 ++++---- test/name-test/test-wait-for-echo.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/name-test/test-activation-forking.py b/test/name-test/test-activation-forking.py index f98537e..44bc1a6 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 49ecbb4..d1b9e0c 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') -- 2.7.4