Issue #64 new

"TypeError: 'NoneType' object is not iterable" inside tests

Emil Stenström
created an issue

Hi! I just upgraded to the latest version of johnny-cache (tip) as a part of porting our site to Django 1.4. Problem is, our tests stop running when the two middleware classes are enabled. Here's the stacktrace:

{{{ (<project>)~/Projects/<project> $ test dialog.DialogTest --failfast Creating test database for alias 'default'... E ====================================================================== ERROR: testPostDialogAnonymously (dialog.tests.DialogTest)

Traceback (most recent call last): File "/Users/<me>/Projects/<project>/dialog/", line 33, in testPostDialogAnonymously }, follow=True) File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/test/", line 449, in post response = super(Client, self).post(path, data=data, content_type=content_type, extra) File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/test/", line 262, in post return self.request(r) File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/core/handlers/", line 117, in get_response response = middleware_method(request, e) File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/core/handlers/", line 111, in get_response response = callback(request, callback_args, callback_kwargs) File "/Users/<me>/Projects/<project>/util/", line 19, in inner return view(request, forum_slug, *args, kwargs) File "/Users/<me>/Projects/<project>/dialog/", line 165, in create return post_view(request, forum_slug, success_view, default_view, private_view, topics=topics, default_referer=default_referer or start_url) File "/Users/<me>/Projects/<project>/util/", line 33, in inner return view(request, forum_slug, args, kwargs) File "/Users/<me>/Projects/<project>/dialog/", line 180, in _create_post user = user_util.process_user_data(request, forum) File "/Users/<me>/Projects/<project>/util/", line 76, in process_user_data get_or_create_new_user(email, name) File "/Users/<me>/Projects/<project>/util/", line 90, in get_or_create_new_user 'email': email, File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/db/models/", line 134, in get_or_create return self.get_query_set().get_or_create(kwargs) File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/db/models/", line 442, in get_or_create return self.get(**lookup), False File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/db/models/", line 361, in get num = len(clone) File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/db/models/", line 85, in len self._result_cache = list(self.iterator()) File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/db/models/", line 291, in iterator for row in compiler.results_iter(): File "/Users/<me>/Envs/<project>/lib/python2.7/site-packages/django/db/models/sql/", line 763, in results_iter for rows in self.execute_sql(MULTI): TypeError: 'NoneType' object is not iterable }}}

I'm not sure how to troubleshoot this further, please let me know what you need from me and I'll fix it.

Comments (4)

  1. Emil Stenström reporter

    I can add that I don't have Johnny enabled when running my tests, since CACHES is not set at all, but the middleware classes are set. Could that be the problem here?

    UPDATE: no, the same error and stacktrace occurs if I set CACHES in my test settings file.

  2. Log in to comment