#11077: Django's built-in tests fail when using url reverse tags in default
registration templates
----------------------------------------+-----------------------------------
          Reporter:  srosro             |         Owner:  nobody
            Status:  closed             |     Milestone:        
         Component:  Testing framework  |       Version:        
        Resolution:  fixed              |      Keywords:        
             Stage:  Unreviewed         |     Has_patch:  0     
        Needs_docs:  0                  |   Needs_tests:  0     
Needs_better_patch:  0                  |  
----------------------------------------+-----------------------------------
Comment (by cmwslw):

 This bug is still present. It's not a duplicate of either of the above
 mentioned cases (#10747, #10976).

 The same exact problem is happening for me using auth and django-
 registration. It doesn't matter whether I reference the URL using the view
 or it's name. The problem lies with the fact that the tests for both
 django.contrib.auth and django-registration set their
 [http://docs.djangoproject.com/en/dev/topics/testing/#django.test.TestCase.urls
 TestCase.urls] setting to override the default URLConf. This problem can
 be resolved by concatenating the test URL patterns and your root URL
 patterns. This is an unfeasible solution because it requires modifying the
 source code. As far as I know, this is the only real solution.

 After googling for hours, I've only found two references to this problem
 besides this ticket:

 [http://www.mail-archive.com/django-us...@googlegroups.com/msg78709.html]

 [http://recurser.com/articles/2009/11/10/noreversematch-custom-
 registration-templates-break-django-unit-tests/]

 The only solution they mention is using something like:
 {{{
 {% url home.views.index as index %}{{ index }}
 }}}
 instead of:
 {{{
 {% url home.views.index}
 }}}
 Although this workaround does not require a source code modification to
 auth or django-registration, it sucks bad because all reversing errors are
 suppressed whether or not it's during a test. I don't really see the point
 of testing if things like that need to be done.

 Apparently not many people use the test suite because this bug will affect
 anyone testing with a reverse() or 'url' tag in their template.

 Possible solution:
 If a
 [http://docs.djangoproject.com/en/dev/topics/testing/#django.test.TestCase.urls
 TestCase.urls] attribute '''is''' set, combine it with the ROOT_URLCONF
 instead of overwriting it. This could be an optional or default feature.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11077#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to