Permalink
Browse files

Fix minor test problems highlighted by codacy.com.

  • Loading branch information...
1 parent 6a9382d commit 07b21f0fe58d0306238359eca0896d8b9c7f0ee6 @ralight ralight committed Apr 9, 2016
Showing with 32 additions and 302 deletions.
  1. +2 −6 misc/currentcost/gnome-panel/CurrentCostMQTT.py
  2. +0 −4 test/broker/01-connect-anon-denied.py
  3. +0 −4 test/broker/01-connect-invalid-id-0-311.py
  4. +0 −4 test/broker/01-connect-invalid-id-0.py
  5. +0 −4 test/broker/01-connect-invalid-id-missing.py
  6. +0 −4 test/broker/01-connect-invalid-protonum.py
  7. +0 −5 test/broker/01-connect-success.py
  8. +0 −4 test/broker/01-connect-uname-no-password-denied.py
  9. +0 −2 test/broker/01-connect-uname-password-denied.py
  10. +0 −4 test/broker/01-connect-uname-password-success-no-tls.py
  11. +0 −4 test/broker/01-connect-uname-password-success.py
  12. +0 −4 test/broker/02-subpub-qos0.py
  13. +0 −2 test/broker/02-subpub-qos1.py
  14. +0 −4 test/broker/02-subpub-qos2.py
  15. +0 −3 test/broker/02-subscribe-qos0.py
  16. +0 −4 test/broker/02-subscribe-qos1.py
  17. +0 −4 test/broker/02-subscribe-qos2.py
  18. +0 −4 test/broker/02-unsubscribe-qos0.py
  19. +0 −2 test/broker/02-unsubscribe-qos1.py
  20. +0 −2 test/broker/02-unsubscribe-qos2.py
  21. +1 −5 test/broker/03-pattern-matching-helper.py
  22. +0 −1 test/broker/03-pattern-matching.py
  23. +0 −4 test/broker/03-publish-b2c-disconnect-qos1-helper.py
  24. +0 −2 test/broker/03-publish-b2c-disconnect-qos1.py
  25. +0 −4 test/broker/03-publish-b2c-disconnect-qos2-helper.py
  26. +0 −3 test/broker/03-publish-b2c-disconnect-qos2.py
  27. +1 −5 test/broker/03-publish-b2c-timeout-qos1-helper.py
  28. +0 −3 test/broker/03-publish-b2c-timeout-qos1.py
  29. +0 −4 test/broker/03-publish-b2c-timeout-qos2-helper.py
  30. +0 −3 test/broker/03-publish-b2c-timeout-qos2.py
  31. +0 −5 test/broker/03-publish-c2b-disconnect-qos2.py
  32. +0 −4 test/broker/03-publish-c2b-timeout-qos2.py
  33. +0 −4 test/broker/03-publish-qos1.py
  34. +0 −2 test/broker/03-publish-qos2.py
  35. +0 −2 test/broker/04-retain-qos0-clear.py
  36. +0 −4 test/broker/04-retain-qos0-fresh.py
  37. +0 −4 test/broker/04-retain-qos0-repeated.py
  38. +0 −4 test/broker/04-retain-qos0.py
  39. +0 −2 test/broker/04-retain-qos1-qos0.py
  40. +1 −5 test/broker/05-clean-session-qos1-helper.py
  41. +0 −2 test/broker/05-clean-session-qos1.py
  42. +0 −2 test/broker/06-bridge-b2br-disconnect-qos1.py
  43. +0 −3 test/broker/06-bridge-b2br-disconnect-qos2.py
  44. +0 −4 test/broker/06-bridge-br2b-disconnect-qos1-helper.py
  45. +0 −2 test/broker/06-bridge-br2b-disconnect-qos1.py
  46. +0 −4 test/broker/06-bridge-br2b-disconnect-qos2-helper.py
  47. +0 −2 test/broker/06-bridge-br2b-disconnect-qos2.py
  48. +1 −5 test/broker/06-bridge-reconnect-local-out-helper.py
  49. +0 −2 test/broker/06-bridge-reconnect-local-out.py
  50. +1 −6 test/broker/07-will-null-helper.py
  51. +0 −2 test/broker/07-will-null-topic.py
  52. +0 −4 test/broker/07-will-null.py
  53. +1 −5 test/broker/07-will-qos0-helper.py
  54. +0 −2 test/broker/07-will-qos0.py
  55. +1 −5 test/broker/08-ssl-bridge-helper.py
  56. +0 −2 test/broker/08-ssl-bridge.py
  57. +1 −3 test/broker/08-ssl-connect-cert-auth-crl.py
  58. +1 −2 test/broker/08-ssl-connect-cert-auth-expired.py
  59. +1 −2 test/broker/08-ssl-connect-cert-auth-revoked.py
  60. +0 −2 test/broker/08-ssl-connect-cert-auth-without.py
  61. +1 −3 test/broker/08-ssl-connect-cert-auth.py
  62. +1 −2 test/broker/08-ssl-connect-identity.py
  63. +2 −3 test/broker/08-ssl-connect-no-auth-wrong-ca.py
  64. +1 −3 test/broker/08-ssl-connect-no-auth.py
  65. +1 −2 test/broker/08-ssl-connect-no-identity.py
  66. +1 −3 test/broker/08-tls-psk-bridge.py
  67. +1 −4 test/broker/08-tls-psk-pub.py
  68. +0 −4 test/broker/09-plugin-auth-unpwd-fail.py
  69. +0 −2 test/broker/09-plugin-auth-unpwd-success.py
  70. +1 −5 test/broker/10-listener-mount-point-helper.py
  71. +0 −3 test/broker/10-listener-mount-point.py
  72. +0 −2 test/lib/01-con-discon-success.py
  73. +0 −1 test/lib/01-keepalive-pingreq.py
  74. +0 −2 test/lib/01-no-clean-session.py
  75. +0 −2 test/lib/01-unpwd-set.py
  76. +0 −2 test/lib/01-will-set.py
  77. +0 −2 test/lib/01-will-unpwd-set.py
  78. +1 −3 test/lib/02-subscribe-qos0.py
  79. +1 −3 test/lib/02-subscribe-qos1.py
  80. +2 −4 test/lib/02-subscribe-qos2.py
  81. +1 −3 test/lib/02-unsubscribe.py
  82. +0 −1 test/lib/03-publish-b2c-qos1.py
  83. +0 −1 test/lib/03-publish-b2c-qos2.py
  84. +0 −2 test/lib/03-publish-c2b-qos1-disconnect.py
  85. +0 −2 test/lib/03-publish-c2b-qos1-timeout.py
  86. +0 −2 test/lib/03-publish-c2b-qos2-disconnect.py
  87. +1 −3 test/lib/03-publish-c2b-qos2-timeout.py
  88. +1 −3 test/lib/03-publish-c2b-qos2.py
  89. +1 −3 test/lib/03-publish-qos0-no-payload.py
  90. +1 −3 test/lib/03-publish-qos0.py
  91. +1 −3 test/lib/04-retain-qos0.py
  92. +0 −4 test/lib/08-ssl-bad-cacert.py
  93. +0 −2 test/lib/08-ssl-connect-cert-auth-enc.py
  94. +0 −2 test/lib/08-ssl-connect-cert-auth.py
  95. +0 −2 test/lib/08-ssl-connect-no-auth.py
  96. +0 −1 test/lib/08-ssl-fake-cacert.py
  97. +0 −2 test/lib/09-util-topic-matching.py
  98. +0 −2 test/lib/09-util-topic-tokenise.py
  99. +1 −1 test/mosq_test.py
@@ -1,12 +1,8 @@
#!/usr/bin/env python
import gnomeapplet
-import gobject
import gtk
import mosquitto
-import os
-import platform
-import pygtk
import sys
class CurrentCostMQTT(gnomeapplet.Applet):
@@ -30,7 +26,7 @@ def on_change_background(self, applet, type, color, pixmap):
def show_menu(self, widget, event):
print "menu"
-
+
def __init__(self, applet, iid):
self.applet = applet
self.label = gtk.Label("0W")
@@ -63,7 +59,7 @@ def CurrentCostMQTT_factory(applet, iid):
main_window.show_all()
gtk.main()
sys.exit()
-
+
if __name__ == '__main__':
gnomeapplet.bonobo_factory("OAFIID:CurrentCostMQTT_Factory", gnomeapplet.Applet.__gtype__, "MQTT", "0", CurrentCostMQTT_factory)
@@ -2,10 +2,6 @@
# Test whether an anonymous connection is correctly denied.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,6 @@
# Test whether a CONNECT with a zero length client id results in the correct CONNACK packet.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,6 @@
# Test whether a CONNECT with a zero length client id results in the correct CONNACK packet.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,6 @@
# Test whether a CONNECT with a zero length client id results in the correct CONNACK packet.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,6 @@
# Test whether a CONNECT with an invalid protocol number results in the correct CONNACK packet.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -3,11 +3,6 @@
# Test whether a valid CONNECT results in the correct CONNACK packet.
import inspect, os, sys
-import os
-import subprocess
-import socket
-import sys
-import time
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -3,10 +3,6 @@
# Test whether a connection is denied if it provides just a username when it
# needs a username and password.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -4,8 +4,6 @@
# incorrect password.
import subprocess
-import socket
-import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -3,10 +3,6 @@
# Test whether a connection is denied if it provides a correct username but
# incorrect password.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -3,10 +3,6 @@
# Test whether a connection is denied if it provides a correct username but
# incorrect password.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,6 @@
# Test whether a client subscribed to a topic receives its own message sent to that topic.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,9 +2,7 @@
# Test whether a client subscribed to a topic receives its own message sent to that topic.
-import subprocess
import socket
-import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -2,10 +2,6 @@
# Test whether a client subscribed to a topic receives its own message sent to that topic.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,7 @@
# Test whether a SUBSCRIBE to a topic with QoS 0 results in the correct SUBACK packet.
-import subprocess
-import socket
import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,6 @@
# Test whether a SUBSCRIBE to a topic with QoS 1 results in the correct SUBACK packet.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,6 @@
# Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -3,10 +3,6 @@
# Test whether a UNSUBSCRIBE to a topic with QoS 0 results in the correct UNSUBACK packet.
# This doesn't assume a subscription exists.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -3,8 +3,6 @@
# Test whether a SUBSCRIBE to a topic with QoS 1 results in the correct SUBACK packet.
import subprocess
-import socket
-import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -3,8 +3,6 @@
# Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet.
import subprocess
-import socket
-import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -1,9 +1,5 @@
#!/usr/bin/env python
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -23,6 +19,6 @@
sock.send(publish_packet)
rc = 0
sock.close()
-
+
exit(rc)
@@ -1,7 +1,6 @@
#!/usr/bin/env python
import subprocess
-import socket
import time
import inspect, os, sys
@@ -1,9 +1,5 @@
#!/usr/bin/env python
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,8 +2,6 @@
import subprocess
import socket
-import time
-from os import environ
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -2,10 +2,6 @@
# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -1,9 +1,6 @@
#!/usr/bin/env python
import subprocess
-import socket
-import time
-from os import environ
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -2,10 +2,6 @@
# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -30,6 +26,6 @@
rc = 0
sock.close()
-
+
exit(rc)
@@ -3,9 +3,6 @@
# Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet.
import subprocess
-import socket
-import time
-from os import environ
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -2,10 +2,6 @@
# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -3,9 +3,6 @@
# Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet.
import subprocess
-import socket
-import time
-from os import environ
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -1,10 +1,5 @@
#!/usr/bin/env python
-import subprocess
-import socket
-import time
-from os import environ
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -4,10 +4,6 @@
# flow. This test introduces delays into the flow in order to force the broker
# to send duplicate PUBREC and PUBCOMP messages.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -2,10 +2,6 @@
# Test whether a PUBLISH to a topic with QoS 1 results in the correct PUBACK packet.
-import subprocess
-import socket
-import time
-
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
@@ -3,8 +3,6 @@
# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow.
import subprocess
-import socket
-import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
Oops, something went wrong.

0 comments on commit 07b21f0

Please sign in to comment.