本文整理匯總了Python中dogstatsd.Server.start方法的典型用法代碼示例。如果您正苦於以下問題:Python Server.start方法的具體用法?Python Server.start怎麽用?Python Server.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dogstatsd.Server
的用法示例。
在下文中一共展示了Server.start方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_start
# 需要導入模塊: from dogstatsd import Server [as 別名]
# 或者: from dogstatsd.Server import start [as 別名]
def test_start(self, select):
select.select.side_effect = [KeyboardInterrupt, SystemExit]
s1 = Server(mock.MagicMock(), '::1', '1234')
s1.start()
self.assertEqual(s1.socket.family, socket.AF_INET6)
s2 = Server(mock.MagicMock(), '127.0.0.1', '2345')
s2.start()
self.assertEqual(s2.socket.family, socket.AF_INET6)
s2 = Server(mock.MagicMock(), 'foo', '80')
s2.start()
self.assertFalse(s2.running)
示例2: test_start
# 需要導入模塊: from dogstatsd import Server [as 別名]
# 或者: from dogstatsd.Server import start [as 別名]
def test_start(self, select):
select.select.side_effect = [KeyboardInterrupt, SystemExit]
s1 = Server(mock.MagicMock(), '::1', '1234')
s1.start()
self.assertEqual(s1.socket.family, socket.AF_INET6)
original_so_rcvbuf = s1.socket.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF)
s2 = Server(mock.MagicMock(), '127.0.0.1', '2345', so_rcvbuf=1023)
s2.start()
self.assertEqual(s2.socket.family, socket.AF_INET6)
self.assertNotEquals(original_so_rcvbuf, s2.socket.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF))
s2 = Server(mock.MagicMock(), 'foo', '80')
s2.start()
self.assertFalse(s2.running)