diff options
author | Steve Langasek <steve.langasek@canonical.com> | 2012-05-24 22:44:25 -0700 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-06-15 12:32:50 +0300 |
commit | ee56337e416c084f4f043acdf129cdc9659b63fc (patch) | |
tree | 03c718904fefc8a731805d103c7d1ea18f60d2b4 /test/test-service | |
parent | ebb2896b3a0504dee9da9aff7664e2a6d7bbfc2f (diff) | |
download | bluez-ee56337e416c084f4f043acdf129cdc9659b63fc.tar.gz |
Update tests to be compatible with gi and python3
This patch makes the python tests source-compatible with python 3, while
leaving the interpreter at python 2 for now.
The tradeoff is that this source is no longer compatible with python
versions < 2.6, and requires gobject-introspection for the glib-based
tests.
Diffstat (limited to 'test/test-service')
-rwxr-xr-x | test/test-service | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/test-service b/test/test-service index 8958201e2..8eea9e242 100755 --- a/test/test-service +++ b/test/test-service @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import absolute_import, print_function, unicode_literals + import sys import dbus import time @@ -26,22 +28,22 @@ service = dbus.Interface(bus.get_object("org.bluez", adapter_path), "org.bluez.Service") if (len(args) < 1): - print "Usage: %s <command>" % (sys.argv[0]) - print "" - print " addrecord <file>" + print("Usage: %s <command>" % (sys.argv[0])) + print("") + print(" addrecord <file>") sys.exit(1) if (args[0] == "addrecord"): if (len(args) < 2): - print "Need file parameter" + print("Need file parameter") else: f = open(args[1]) record = f.read() f.close() handle = service.AddRecord(record) - print "0x%x" % (handle) + print("0x%x" % (handle)) time.sleep(120) sys.exit(0) -print "Unknown command" +print("Unknown command") sys.exit(1) |