Parcourir la source

[1275] restore the finally statement in run function in the MockMsgq class.
As a result of considering any other situation where self.msgq.run() in the
try statement is accidentally failed. This changes don't affect the result of
the unittest.

Naoki Kambe il y a 13 ans
Parent
commit
8b024ff407
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      src/bin/stats/tests/test_utils.py

+ 5 - 0
src/bin/stats/tests/test_utils.py

@@ -101,6 +101,11 @@ class MockMsgq:
             self.msgq.run()
         except Exception:
             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):
         # do nothing