Browse Source

[1175] modify test_utils.py

 - explicitly shut down the socket of the msgq before shutting down
   the msgq

 - do nothing in the shutdown method of MockMsgq for avoiding shutting
   down the msgq twice

 - replace the stop method in the shutdown method of the MyStatsHttpd
   with the shutdown command of stats_httpd
Naoki Kambe 13 years ago
parent
commit
7808524aa9
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/bin/stats/tests/test_utils.py

+ 6 - 2
src/bin/stats/tests/test_utils.py

@@ -99,10 +99,14 @@ class MockMsgq:
         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):
-        self.msgq.shutdown()
+        # do nothing for avoiding shutting down the msgq twice
+        pass
 
 class MockCfgmgr:
     def __init__(self):
@@ -323,7 +327,7 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
             pass
 
     def shutdown(self):
-        self.stop()
+        self.command_handler('shutdown', None)
 
 class BaseModules:
     def __init__(self):