我使用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