Created
June 4, 2013 11:40
-
-
Save rajendrakrp/5705313 to your computer and use it in GitHub Desktop.
Unit testing in NDB based app is not working.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(virt_flask)rajendra@rajendra-ub12-054:~/gae_projects/tick$ nosetests -v --with-gae tests | |
test_home_page (tests.test_users.DemoTest) ... ok | |
test_users (tests.test_users.DemoTest) ... ERROR | |
====================================================================== | |
ERROR: test_users (tests.test_users.DemoTest) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/rajendra/gae_projects/tick/tests/test_users.py", line 51, in test_users | |
self.create_user('test@example.com', '123', True) | |
File "/home/rajendra/gae_projects/tick/tests/test_users.py", line 42, in create_user | |
u.put() | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/model.py", line 3208, in _put | |
return self._put_async(**ctx_options).get_result() | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/tasklets.py", line 325, in get_result | |
self.check_success() | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along | |
value = gen.throw(exc.__class__, exc, tb) | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/context.py", line 733, in put | |
key = yield self._put_batcher.add(entity, options) | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/tasklets.py", line 371, in _help_tasklet_along | |
value = gen.send(val) | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/context.py", line 286, in _put_tasklet | |
'Expected %r, got %r' % (key, ent._key)) | |
BadKeyError: Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123') | |
-------------------- >> begin captured stdout << --------------------- | |
Calling set up | |
user: test@example.com | |
--------------------- >> end captured stdout << ---------------------- | |
-------------------- >> begin captured logging << -------------------- | |
root: DEBUG: all_pending: add <Future a80d38c created by _put_async(model.py:3224) for tasklet put(context.py:696); pending> | |
root: DEBUG: nowevent: _help_tasklet_along | |
root: DEBUG: Sending None to initial generator put(context.py:696) | |
root: DEBUG: all_pending: add <Future a80d46c created by add(context.py:143) for AutoBatcher(_memcache_set_tasklet).add(('NDB9:agp0aWNrLXRyYWNrchELEghVc2VyUHJvZiIDMTIzDA', 0), ('set', 32, '', None)); pending> | |
root: DEBUG: AutoBatcher(_memcache_set_tasklet): creating new queue for ('set', 32, '', None) | |
root: DEBUG: initial generator put(context.py:696) yielded <Future a80d46c created by add(context.py:143) for AutoBatcher(_memcache_set_tasklet).add(('NDB9:agp0aWNrLXRyYWNrchELEghVc2VyUHJvZiIDMTIzDA', 0), ('set', 32, '', None)); pending> | |
root: DEBUG: <Future a80d38c created by _put_async(model.py:3224) for tasklet put(context.py:696) suspended generator put(context.py:719); pending> is now blocked waiting for <Future a80d46c created by add(context.py:143) for AutoBatcher(_memcache_set_tasklet).add(('NDB9:agp0aWNrLXRyYWNrchELEghVc2VyUHJvZiIDMTIzDA', 0), ('set', 32, '', None)); pending> | |
root: DEBUG: idler: _on_idle | |
root: DEBUG: AutoBatcher(_memcache_set_tasklet): 1 items | |
root: DEBUG: all_pending: add <Future a80d84c created by run_queue(context.py:132) for tasklet _memcache_set_tasklet(context.py:1019); pending> | |
root: DEBUG: nowevent: _help_tasklet_along | |
root: DEBUG: Sending None to initial generator _memcache_set_tasklet(context.py:1019) | |
root: DEBUG: initial generator _memcache_set_tasklet(context.py:1019) yielded <google.appengine.api.apiproxy_stub_map.UserRPC object at 0xa80d44c> | |
root: DEBUG: idler: _on_idle | |
root: DEBUG: idler _on_idle removed | |
root: DEBUG: rpc: memcache.Set | |
root: DEBUG: Sending {'NDB9:agp0aWNrLXRyYWNrchELEghVc2VyUHJvZiIDMTIzDA': 1} to suspended generator _memcache_set_tasklet(context.py:1030) | |
root: DEBUG: all_pending: success: remove <Future a80d46c created by add(context.py:143) for AutoBatcher(_memcache_set_tasklet).add(('NDB9:agp0aWNrLXRyYWNrchELEghVc2VyUHJvZiIDMTIzDA', 0), ('set', 32, '', None)); result True> | |
root: DEBUG: suspended generator _memcache_set_tasklet(context.py:1030) returned None | |
root: DEBUG: all_pending: success: remove <Future a80d84c created by run_queue(context.py:132) for tasklet _memcache_set_tasklet(context.py:1019); result None> | |
root: DEBUG: nowevent: _on_future_completion | |
root: DEBUG: <Future a80d38c created by _put_async(model.py:3224) for tasklet put(context.py:696); pending> is no longer blocked waiting for <Future a80d46c created by add(context.py:143) for AutoBatcher(_memcache_set_tasklet).add(('NDB9:agp0aWNrLXRyYWNrchELEghVc2VyUHJvZiIDMTIzDA', 0), ('set', 32, '', None)); result True> | |
root: DEBUG: Sending True to suspended generator put(context.py:719) | |
root: DEBUG: all_pending: add <Future a80bfcc created by add(context.py:143) for AutoBatcher(_put_tasklet).add(test@example.com, None); pending> | |
root: DEBUG: AutoBatcher(_put_tasklet): creating new queue for None | |
root: DEBUG: suspended generator put(context.py:719) yielded <Future a80bfcc created by add(context.py:143) for AutoBatcher(_put_tasklet).add(test@example.com, None); pending> | |
root: DEBUG: <Future a80d38c created by _put_async(model.py:3224) for tasklet put(context.py:696) suspended generator put(context.py:733); pending> is now blocked waiting for <Future a80bfcc created by add(context.py:143) for AutoBatcher(_put_tasklet).add(test@example.com, None); pending> | |
root: DEBUG: nowevent: _finished_callback | |
root: DEBUG: idler: _on_idle | |
root: DEBUG: AutoBatcher(_put_tasklet): 1 items | |
root: DEBUG: all_pending: add <Future a80bd2c created by run_queue(context.py:132) for tasklet _put_tasklet(context.py:270); pending> | |
root: DEBUG: nowevent: _help_tasklet_along | |
root: DEBUG: Sending None to initial generator _put_tasklet(context.py:270) | |
root: DEBUG: initial generator _put_tasklet(context.py:270) yielded <google.appengine.api.apiproxy_stub_map.UserRPC object at 0xa80decc> | |
root: DEBUG: idler: _on_idle | |
root: DEBUG: idler _on_idle removed | |
root: DEBUG: rpc: datastore_v3.Put | |
root: DEBUG: Sending [Key('UserProf', '123')] to suspended generator _put_tasklet(context.py:280) | |
root: WARNING: suspended generator _put_tasklet(context.py:280) raised BadKeyError(Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123')) | |
Traceback (most recent call last): | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/tasklets.py", line 371, in _help_tasklet_along | |
value = gen.send(val) | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/context.py", line 286, in _put_tasklet | |
'Expected %r, got %r' % (key, ent._key)) | |
BadKeyError: Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123') | |
root: DEBUG: all_pending: fail: remove <Future a80bd2c created by run_queue(context.py:132) for tasklet _put_tasklet(context.py:270); exception BadKeyError: Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123')> | |
root: DEBUG: nowevent: _finished_callback | |
root: DEBUG: all_pending: fail: remove <Future a80bfcc created by add(context.py:143) for AutoBatcher(_put_tasklet).add(test@example.com, None); exception BadKeyError: Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123')> | |
root: DEBUG: nowevent: _on_future_completion | |
root: DEBUG: <Future a80d38c created by _put_async(model.py:3224) for tasklet put(context.py:696); pending> is no longer blocked waiting for <Future a80bfcc created by add(context.py:143) for AutoBatcher(_put_tasklet).add(test@example.com, None); exception BadKeyError: Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123')> | |
root: DEBUG: Throwing BadKeyError(Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123')) into suspended generator put(context.py:733) | |
root: WARNING: suspended generator put(context.py:733) raised BadKeyError(Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123')) | |
Traceback (most recent call last): | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along | |
value = gen.throw(exc.__class__, exc, tb) | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/context.py", line 733, in put | |
key = yield self._put_batcher.add(entity, options) | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/tasklets.py", line 371, in _help_tasklet_along | |
value = gen.send(val) | |
File "/home/rajendra/gae_projects/google_appengine/google/appengine/ext/ndb/context.py", line 286, in _put_tasklet | |
'Expected %r, got %r' % (key, ent._key)) | |
BadKeyError: Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123') | |
root: DEBUG: all_pending: fail: remove <Future a80d38c created by _put_async(model.py:3224) for tasklet put(context.py:696); exception BadKeyError: Entity key differs from the one returned by the datastore. Expected Key('UserProf', '123'), got Key('UserProf', '123')> | |
--------------------- >> end captured logging << --------------------- | |
---------------------------------------------------------------------- | |
Ran 2 tests in 0.045s | |
FAILED (errors=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment