Commit 5ab87bf9 authored by Naoki Kambe's avatar Naoki Kambe
Browse files

[1275] modify test_utils.py

 - remove the finally statement from the run method in the MockMsgq class.
   Because it is found that it doesn't actually work even if it is there.  And
   also it is found that self.msgq.shutdown() doesn't work even though outside
   of the thread.

 - instead of self.msgq.shutdown(), add the removal of the socket file into the
   shutdown method in the BaseModules class
parent a5eeb731
...@@ -105,14 +105,9 @@ class MockMsgq: ...@@ -105,14 +105,9 @@ class MockMsgq:
self.msgq.run() self.msgq.run()
except Exception: except Exception:
pass pass
finally:
# explicitly shut down the socket of the msgq before
# shutting down the msgq
self.msgq.listen_socket.shutdown(msgq.socket.SHUT_RDWR)
self.msgq.shutdown()
def shutdown(self): def shutdown(self):
# do nothing for avoiding shutting down the msgq twice # do nothing
pass pass
class MockCfgmgr: class MockCfgmgr:
...@@ -362,3 +357,10 @@ class BaseModules: ...@@ -362,3 +357,10 @@ class BaseModules:
self.cfgmgr.shutdown() self.cfgmgr.shutdown()
# MockMsgq # MockMsgq
self.msgq.shutdown() self.msgq.shutdown()
# remove the unused socket file
socket_file = self.msgq.server.msgq.socket_file
try:
if os.path.exists(socket_file):
os.remove(socket_file)
except OSError:
pass
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment