Python 线程服务器断开管道错误
我已经安装了SimpleServer。现在我想用unittest测试它。在test.py文件中,我有一个类test(unittest.TestCase) 运行代码时,其中一个测试出现断管错误:Python 线程服务器断开管道错误,python,python-2.7,python-unittest,broken-pipe,Python,Python 2.7,Python Unittest,Broken Pipe,我已经安装了SimpleServer。现在我想用unittest测试它。在test.py文件中,我有一个类test(unittest.TestCase) 运行代码时,其中一个测试出现断管错误: File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/S
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
self.wfile.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
若我从一个地方运行服务器,并从另一个地方执行unittest,那个么并没有错误。在整个过程中,两侧的连接都处于打开状态。问题出在哪里?在再次运行脚本之前,您可以等待几分钟。您是否使用了一些不寻常的网络技术,如多播?class ThreadedSimpleServer(SocketServer.ThreadingMixIn,HTTPServer):通过。类RequestHandler(SimpleHTTPRequestHandler):。ThreadedSimpleServer(地址,RequestHandler)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
self.wfile.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe