[elbe-devel] [PATCH 10/19] test: make flake8 compatible
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Mar 19 08:47:39 CET 2024
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
test/updated.py | 47 +++++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 24 deletions(-)
diff --git a/test/updated.py b/test/updated.py
index 3685f33925e7..e757edf20297 100755
--- a/test/updated.py
+++ b/test/updated.py
@@ -7,12 +7,11 @@
import sys
import threading
import time
-
from optparse import OptionParser
from wsgiref.simple_server import make_server
+from spyne import Application, ServiceBase, rpc
from spyne.model.primitive import String
-from spyne import Application, rpc, ServiceBase
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
@@ -27,17 +26,17 @@ class MonitorService (ServiceBase):
class MonitorThread (threading.Thread):
def __init__(self, port):
- threading.Thread.__init__(self, name="MonitorThread")
+ threading.Thread.__init__(self, name='MonitorThread')
self.port = port
self.server = None
def run(self):
- print("monitor ready :%s" % (self.port))
+ print('monitor ready :%s' % (self.port))
application = Application([MonitorService], 'monitor',
in_protocol=Soap11(validator='lxml'),
out_protocol=Soap11())
wsgi_application = WsgiApplication(application)
- self.server = make_server("", int(self.port), wsgi_application)
+ self.server = make_server('', int(self.port), wsgi_application)
self.server.serve_forever()
@@ -49,22 +48,22 @@ def shutdown(mon):
sys.exit(0)
-oparser = OptionParser(usage="usage: %prog [options]")
+oparser = OptionParser(usage='usage: %prog [options]')
-oparser.add_option("--debug", dest="debug", action="store_true",
- default=False, help="run in debug mode")
+oparser.add_option('--debug', dest='debug', action='store_true',
+ default=False, help='run in debug mode')
-oparser.add_option("--target", dest="target", default="localhost",
- help="ip or hostname of target", type="string")
+oparser.add_option('--target', dest='target', default='localhost',
+ help='ip or hostname of target', type='string')
-oparser.add_option("--port", dest="port", default="8080",
- help="port of updated on target", type="string")
+oparser.add_option('--port', dest='port', default='8080',
+ help='port of updated on target', type='string')
-oparser.add_option("--listen", dest="host", default="localhost",
- help="interface ip", type="string")
+oparser.add_option('--listen', dest='host', default='localhost',
+ help='interface ip', type='string')
-oparser.add_option("--monitorport", dest="monitorport", default="8087",
- help="port used for update monitor", type="string")
+oparser.add_option('--monitorport', dest='monitorport', default='8087',
+ help='port used for update monitor', type='string')
(opt, args) = oparser.parse_args(sys.argv)
@@ -73,11 +72,11 @@ if opt.debug:
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
-wsdl = "http://" + opt.target + ":" + opt.port + "/?wsdl"
+wsdl = 'http://' + opt.target + ':' + opt.port + '/?wsdl'
try:
control = Client(wsdl)
except BaseException:
- print(wsdl, "not reachable")
+ print(wsdl, 'not reachable')
sys.exit(1)
monitor = MonitorThread(opt.monitorport)
@@ -86,10 +85,10 @@ monitor.start()
time.sleep(1) # hack to ensure that monitor server was started
try:
- monitor_wsdl = "http://" + opt.host + ":" + opt.monitorport + "/?wsdl"
+ monitor_wsdl = 'http://' + opt.host + ':' + opt.monitorport + '/?wsdl'
control.service.register_monitor(monitor_wsdl)
except BaseException:
- print("monitor couldn't be registered (port already in use?)")
+ print("monitor couldn\'t be registered (port already in use?)")
shutdown(monitor)
while 1:
@@ -98,16 +97,16 @@ while 1:
try:
snapshots = s.split(',')
- print("select snapshot:")
+ print('select snapshot:')
i = 0
for s in snapshots:
if s:
- print(" [%d] %s" % (i, s))
+ print(' [%d] %s' % (i, s))
i = i + 1
except BaseException:
- print("no snapshots available")
+ print('no snapshots available')
- sys.stdout.write("% ")
+ sys.stdout.write('% ')
sys.stdout.flush()
try:
--
2.44.0
More information about the elbe-devel
mailing list