水管坏了错误,同时运行Django的测试与硒

在运行Django的测试与硒(无遥控,无XVFB),我总是得到以下异常:水管坏了错误,同时运行Django的测试与硒

Creating test database for alias 'default'... 

Traceback (most recent call last):

File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run

self.finish_response()

File "/usr/lib/python2.7/wsgiref/handlers.py", line 127, in finish_response

self.write(data)

File "/usr/lib/python2.7/wsgiref/handlers.py", line 210, in write

self.send_headers()

File "/usr/lib/python2.7/wsgiref/handlers.py", line 268, in send_headers

self.send_preamble()

File "/usr/lib/python2.7/wsgiref/handlers.py", line 192, in send_preamble

'Date: %s\r\n' % format_date_time(time.time())

File "/usr/lib/python2.7/socket.py", line 324, in write

----------------------------------------

Exception happened during processing of request from ('127.0.0.1', 44089)

self.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

Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/django/test/testcases.py", line 981, in _handle_request_noblock

self.process_request(request, client_address)

File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request

self.finish_request(request, client_address)

File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request

self.RequestHandlerClass(request, client_address, self)

File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 139, in __init__

----------------------------------------

super(WSGIRequestHandler, self).__init__(*args, **kwargs)

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

Destroying test database for alias 'default'...

Process finished with exit code 0

测试是使用Django 1.4 LiveServerTestCase运行,使用Firefox WebDriver的硒python绑定2.28.0。有人有一个想法,如何解决它?

回答:

确保请求页面的浏览器正在等待响应。

如果我没有记错的话,那就是selenium_client.implicitly_wait(sec)selenium_client.set_page_load_timeout(sec)命令,请确保你在使用它。

如果服务器不尝试写入由于浏览器在发送响应之前关闭连接而损坏的管道。

以上是 水管坏了错误,同时运行Django的测试与硒 的全部内容, 来源链接: utcz.com/qa/264798.html

回到顶部