THRIFT-4370: build generated code before running static code analysis;
fix E722 flake8 issues identified in python code
This closes #1399
diff --git a/test/features/container_limit.py b/test/features/container_limit.py
index a16e364..88f8487 100644
--- a/test/features/container_limit.py
+++ b/test/features/container_limit.py
@@ -61,7 +61,7 @@
print('[OK]: just limit')
try:
test_list(proto, list(range(args.limit + 1)))
- except:
+ except Exception:
print('[OK]: limit + 1')
else:
print('[ERROR]: limit + 1')
diff --git a/test/features/string_limit.py b/test/features/string_limit.py
index 14f57d0..b8991d6 100644
--- a/test/features/string_limit.py
+++ b/test/features/string_limit.py
@@ -51,7 +51,7 @@
print('[OK]: just limit')
try:
test_string(proto, 'a' * (args.limit + 1))
- except:
+ except Exception:
print('[OK]: limit + 1')
else:
print('[ERROR]: limit + 1')
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index a7366a8..04ad62a 100755
--- a/test/py/TestServer.py
+++ b/test/py/TestServer.py
@@ -193,7 +193,7 @@
try:
pfactory.string_length_limit = options.string_limit
pfactory.container_length_limit = options.container_limit
- except:
+ except Exception:
# Ignore errors for those protocols that does not support length limit
pass
@@ -255,7 +255,7 @@
logging.info('Requesting server to stop()')
try:
server.stop()
- except:
+ except Exception:
pass
signal.signal(signal.SIGALRM, clean_shutdown)
signal.alarm(4)
diff --git a/test/py/TestSocket.py b/test/py/TestSocket.py
index ae3160f..619eb10 100755
--- a/test/py/TestSocket.py
+++ b/test/py/TestSocket.py
@@ -36,7 +36,7 @@
self.listen_sock.bind(('localhost', self.port))
self.listen_sock.listen(5)
break
- except:
+ except Exception:
if i == 49:
raise
@@ -50,7 +50,7 @@
socket.setTimeout(10)
socket.open()
leaky.append(socket)
- except:
+ except Exception:
self.assert_(time.time() - starttime < 5.0)
def testWriteTimeout(self):
@@ -64,7 +64,7 @@
while True:
lsock.write("hi" * 100)
- except:
+ except Exception:
self.assert_(time.time() - starttime < 5.0)