Nosetests. maximum recursion depth exceeded

190 views
Skip to first unread message

Oleg Oltar

unread,
Feb 3, 2009, 4:31:07 AM2/3/09
to django...@googlegroups.com, Alexander Solovyov, andriy.k...@gmail.com
Hi!

I am creating one of my firsts django projects. I created nose tests to cover my application and got 100% code coverage


Now I am trying to modify my project to make settings be platform independent. So I added following lines 
to my settings.py:

# Django settings for loginregister project.
import os.path
import sys

PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))

DATABASE_NAME = os.path.join(PROJECT_ROOT, 'users.db')  # Or path to database file if using sqlite3.

ROOT_URLCONF = 'urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(PROJECT_ROOT, 'templates')
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.admin',
    'django.contrib.sessions',
    'django.contrib.sites',
    'loginreg'
    )

Now when I run my application everything seems to work! Everything but my nosetests which returns long trace for me
which contains one line (displayed many times):

    sub_match = pattern.resolve(new_path)
  File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 181, in resolve
    sub_match = pattern.resolve(new_path)
  File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 181, in resolve
    sub_match = pattern.resolve(new_path)
  File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 179, in resolve
    for pattern in self.urlconf_module.urlpatterns:
RuntimeError: maximum recursion depth exceeded

(I use: beryl:db_settings oleg$ nosetests --cover-package=loginreg --with-coverage    to run tests)



Could anyone suggest why I am getting it?


Thanks,
Oleg

Steve Holden

unread,
Feb 3, 2009, 12:08:19 PM2/3/09
to django...@googlegroups.com
Oleg Oltar wrote:
[...]

>
> sub_match = pattern.resolve(new_path)
> File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py",
> line 181, in resolve
> sub_match = pattern.resolve(new_path)
> File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py",
> line 181, in resolve
> sub_match = pattern.resolve(new_path)
> File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py",
> line 179, in resolve
> for pattern in self.urlconf_module.urlpatterns:
> RuntimeError: maximum recursion depth exceeded
>
> (I use: beryl:db_settings oleg$ nosetests --cover-package=loginreg
> --with-coverage to run tests)
>
>
>
> Could anyone suggest why I am getting it?
>
Is something doing a 301 redirection to itself, possibly?

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Oleg Oltar

unread,
Feb 3, 2009, 1:59:36 PM2/3/09
to django...@googlegroups.com
Why it worked before I tried to change settings.py? Why actually site works?

Maybe something is in my tests?

Btw, my code organized this way:

/proj
   urls.py
   settings
  ./app
      tests.py
      urls.py


As I changed the project name I also hacked the tests file so now it contains following:
import os
import re



os.environ['PYTHNONPATH'] = '$PYTHONPATH:$PWD'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'  # Is this correct?


I presume that the second line is incorrect. Where it looks for the settings?

Oleg Oltar

unread,
Feb 3, 2009, 2:05:37 PM2/3/09
to django...@googlegroups.com
Seems no :(

I tried to manually specify correct path
os.environ['DJANGO_SETTINGS_MODULE'] = 'db_settings.settings'
but have same issue :(

(NOTE, i didn't create it with startpoject command, I just cloned project from repo. May it help to understand the issue?)

Oleg Oltar

unread,
Feb 3, 2009, 4:54:57 PM2/3/09
to django...@googlegroups.com
Well seems I found the solution. I just moved the project folder in my repo (so now we have repo->myproject), so the name myproject will not change after cloning, and now it all works


Any idea why?
Reply all
Reply to author
Forward
0 new messages