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-proximity | |
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-proximity')
-rwxr-xr-x | test/test-proximity | 14 |
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() |