1

this error arises when i try to run the following test case which is written in models.py of my django app named 'administration' :

from django.test import Client, TestCase
from django.core import mail


class ClientTest( TestCase ):

    fixtures = [ 'testdata.json' ]

    def test_get_register( self ):
        response = self.client.get( '/accounts/register/', {} )
        self.assertEqual( response.status_code, 200 )

the error arises at this line specifically:

response = self.client.get( '/accounts/register/', {} ) 

my django version is 1.2.1 and python 2.6 and satchmo version is 0.9.2-pre hg-unknown. I code in windows platform(xp sp2). The command to run test case is:

python manage.py test administration

the complete error log is as follow:

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 121, in by_host

    site = by_host(host=host[4:], id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 124, in by_host

    site = by_host(host = 'www.%s' % host, id_only=id_only)
  File "build\bdist.win32\egg\threaded_multihost\sites.py", line 101, in by_host

    site = Site.objects.get(domain=host)
  File "C:\django\django\db\models\manager.py", line 132, in get
    return self.get_query_set().get(*args, **kwargs)
  File "C:\django\django\db\models\query.py", line 336, in get
    num = len(clone)
  File "C:\django\django\db\models\query.py", line 81, in __len__
    self._result_cache = list(self.iterator())
  File "C:\django\django\db\models\query.py", line 269, in iterator
    for row in compiler.results_iter():
  File "C:\django\django\db\models\sql\compiler.py", line 672, in results_iter
    for rows in self.execute_sql(MULTI):
  File "C:\django\django\db\models\sql\compiler.py", line 717, in execute_sql
    sql, params = self.as_sql()
  File "C:\django\django\db\models\sql\compiler.py", line 65, in as_sql
    where, w_params = self.query.where.as_sql(qn=qn, connection=self.connection)

  File "C:\django\django\db\models\sql\where.py", line 91, in as_sql
    sql, params = child.as_sql(qn=qn, connection=connection)
  File "C:\django\django\db\models\sql\where.py", line 94, in as_sql
    sql, params = self.make_atom(child, qn, connection)
  File "C:\django\django\db\models\sql\where.py", line 141, in make_atom
    lvalue, params = lvalue.process(lookup_type, params_or_value, connection)
  File "C:\django\django\db\models\sql\where.py", line 312, in process
    connection=connection, prepared=True)
  File "C:\django\django\db\models\fields\subclassing.py", line 53, in inner
    return func(*args, **kwargs)
  File "C:\django\django\db\models\fields\subclassing.py", line 53, in inner
    return func(*args, **kwargs)
  File "C:\django\django\db\models\fields\__init__.py", line 323, in get_db_prep
_lookup
    return [self.get_db_prep_value(value, connection=connection, prepared=prepar
ed)]
  File "C:\django\django\db\models\fields\subclassing.py", line 53, in inner
    return func(*args, **kwargs)
  File "C:\django\django\db\models\fields\subclassing.py", line 53, in inner
    return func(*args, **kwargs)
RuntimeError: maximum recursion depth exceeded while calling a Python object

----------------------------------------------------------------------
Ran 7 tests in 48.453s

FAILED (errors=1)
Destroying test database 'default'...

1 Answer 1

1

django test client uses default base url:

http://testserver/

which makes your test url /accounts/register/ into:

http://testserver/accounts/register/

so you should add 'testserver' in django sites.site model as a base url. maximum recursion depth exceed because django client did'nt find 'testserver' as a domain in sites.site

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.