使用selenium运行django-test时错误的管道错误 [英] Broken Pipe Error while running django-test with selenium

查看:536
本文介绍了使用selenium运行django-test时错误的管道错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用selenium进行django测试(没有远程,没有xvfb)时,我总是得到以下异常:

while running django tests with selenium (no remote, no xvfb), I always get the following exception:

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

测试使用LiveJetTestCase使用django 1.4和selenium python-bindings 2.28.0与Firefox WebDriver一起运行。有人有一个想法,如何解决它?

Tests are run with LiveServerTestCase using django 1.4 and selenium python-bindings 2.28.0 with Firefox WebDriver. Does someone have an idea, on how to resolve it?

推荐答案

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

Make sure that the browser requesting the page is waiting for the response.

如果我记得正确,则会有 selenium_client.implicitly_wait(sec) selenium_client .set_page_load_timeout(sec)命令,请确保您正在使用它。

If i remember correctly there is the selenium_client.implicitly_wait(sec) and selenium_client.set_page_load_timeout(sec) commands for that, make sure you are using it.

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

If not the server will try to write to a pipe that is broken because the browser close the connection before the response was sent.

这篇关于使用selenium运行django-test时错误的管道错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆