0
我有服務/讀取某些數據的客戶端和服務器腳本。Python客戶端 - 服務器腳本單元測試錯誤
當我嘗試使用PyUnit編寫單元測試時,出現一個錯誤,我無法推理它。
下面是相關的代碼片段:
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
#some set up operations
def testRecieve(self):
s = socket.socket()
s.connect((FEED_SERVER_HOST, FEED_SERVER_PORT))
sock = socket.socket()
#some recieve operations
s.close()
# When i write this code snippet below, i get error: [Errno 98] Address already in use
error. I tried closing 's' socket in tearDown function but still same error raising.
def testAnotherRecieve(self):
sock = socket.socket() # Results ERRNO 98.
作爲總結,我不能創建在單元測試類第二插座。什麼可能會導致此錯誤?