summaryrefslogtreecommitdiff
path: root/test/test-proximity
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2012-05-24 22:44:25 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-15 12:32:50 +0300
commitee56337e416c084f4f043acdf129cdc9659b63fc (patch)
tree03c718904fefc8a731805d103c7d1ea18f60d2b4 /test/test-proximity
parentebb2896b3a0504dee9da9aff7664e2a6d7bbfc2f (diff)
downloadbluez-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-proximity')
-rwxr-xr-xtest/test-proximity14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/test-proximity b/test/test-proximity
index 130590cab..b08a62a1e 100755
--- a/test/test-proximity
+++ b/test/test-proximity
@@ -1,5 +1,7 @@
#!/usr/bin/python
+from __future__ import absolute_import, print_function, unicode_literals
+
'''
Proximity Monitor test script
'''
@@ -13,7 +15,7 @@ from optparse import OptionParser, make_option
def property_changed(name, value):
- print "PropertyChanged('%s', '%s')" % (name, value)
+ print("PropertyChanged('%s', '%s')" % (name, value))
mainloop.quit()
if __name__ == "__main__":
@@ -44,10 +46,10 @@ if __name__ == "__main__":
"org.bluez.Adapter")
if (len(args) < 1):
- print "Usage: %s <command>" % (sys.argv[0])
- print ""
- print " -b MAC LinkLossAlertLevel <none|mild|high>"
- print " -b MAC ImmediateAlertLevel <none|mild|high>"
+ print("Usage: %s <command>" % (sys.argv[0]))
+ print("")
+ print(" -b MAC LinkLossAlertLevel <none|mild|high>")
+ print(" -b MAC ImmediateAlertLevel <none|mild|high>")
sys.exit(1)
device_path = adapter.FindDevice(options.address)
@@ -59,7 +61,7 @@ if __name__ == "__main__":
proximity = dbus.Interface(bus.get_object("org.bluez",
device_path), "org.bluez.ProximityMonitor")
- print "Proximity SetProperty('%s', '%s')" % (args[0], args[1])
+ print("Proximity SetProperty('%s', '%s')" % (args[0], args[1]))
proximity.SetProperty(args[0], args[1])
mainloop = gobject.MainLoop()