我使用gae和Python 2.7,升级到gae 1.7.6后,我的单元测试被破坏。我正在使用nose和nosega进行单元测试。有谁知道发生了什么事?任何想法将非常感激。我觉得这与webob 1.2.3被升级到GA有关。升级到appengine后断开连接错误1.7.6
self.app.post(task['url'], params, headers)
File "/Library/Python/2.7/site-packages/WebTest-1.4.0-py2.7.egg/webtest/app.py", line 835, in post
content_type=content_type)
File "/Library/Python/2.7/site-packages/WebTest-1.4.0-py2.7.egg/webtest/app.py", line 807, in _gen_request
expect_errors=expect_errors)
File "/Library/Python/2.7/site-packages/WebTest-1.4.0-py2.7.egg/webtest/app.py", line 1118, in do_request
self._check_status(status, res)
File "/Library/Python/2.7/site-packages/WebTest-1.4.0-py2.7.egg/webtest/app.py", line 1154, in _check_status
res)
AppError: Bad response: 500 Internal Server Error (not 200 OK or 3xx redirect for http://localhost/task/request_log)
<pre>Traceback (most recent call last):
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1089, in __call__
method(*args, **kwargs)
File "/Users/***/projects/game_server/game_service/events.py", line 184, in post
inputs = pickle.loads(self.request.body)
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3/webob/request.py", line 677, in _body__get
self.make_body_seekable() # we need this to have content_length
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3/webob/request.py", line 922, in make_body_seekable
self.copy_body()
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3/webob/request.py", line 945, in copy_body
self.body = self.body_file.read(self.content_length)
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3/webob/request.py", line 1528, in readinto
+ "(%d more bytes were expected)" % self.remaining
DisconnectionError: The client disconnected while sending the POST/PUT body (151 more bytes were expected)
</pre>
self.app.post(task['url'], params, headers)
File "/Library/Python/2.7/site-packages/WebTest-1.4.0-py2.7.egg/webtest/app.py", line 835, in post
content_type=content_type)
File "/Library/Python/2.7/site-packages/WebTest-1.4.0-py2.7.egg/webtest/app.py", line 807, in _gen_request
expect_errors=expect_errors)
File "/Library/Python/2.7/site-packages/WebTest-1.4.0-py2.7.egg/webtest/app.py", line 1118, in do_request
self._check_status(status, res)
File "/Library/Python/2.7/site-packages/WebTest-1.4.0-py2.7.egg/webtest/app.py", line 1154, in _check_status
res)
AppError: Bad response: 500 Internal Server Error (not 200 OK or 3xx redirect for http://localhost/task/request_log)
<pre>Traceback (most recent call last):
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1089, in __call__
method(*args, **kwargs)
File "/Users/***/projects/game_server/game_service/events.py", line 184, in post
inputs = pickle.loads(self.request.body)
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3/webob/request.py", line 677, in _body__get
self.make_body_seekable() # we need this to have content_length
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3/webob/request.py", line 922, in make_body_seekable
self.copy_body()
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3/webob/request.py", line 945, in copy_body
self.body = self.body_file.read(self.content_length)
File "/Users/***/Downloads/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3/webob/request.py", line 1528, in readinto
+ "(%d more bytes were expected)" % self.remaining
DisconnectionError: The client disconnected while sending the POST/PUT body (151 more bytes were expected)
</pre>
有趣的,不知道为什么发生这种情况,因为请求是由WebTest准备的,并且只有在升级到appengine 1.7.6时才会中断。我已经浏览了webtest代码,并且代码设置了内容长度 – marcadian 2013-03-26 18:33:14
我在1.7.6中遇到了很多问题。我回到了old_dev_appserver。 – Mohamed 2013-03-27 23:52:52
是的,我现在也恢复到1.7.5 – marcadian 2013-03-28 19:50:33