2

When running nosetests, django-nose runner doesn't supply --with-django option to nosetests, so my nose + Twill tests fail when trying to access URLs:

./manage.py test
...
raise BrowserStateError("cannot go to '%s'" % (url,))
BrowserStateError: cannot go to 'http://127.0.0.1:8088/admin/'
----------------------------------------------------------------------
Ran 2 tests in 0.166s

FAILED (errors=1)

When I supply --with-django manually or set NOSE_WITH_DJANGO=1 enviromental variable, my tests run successfully, but then I receive following exception:

$ ./manage.py test --with-django
...
Ran 2 tests in 0.199s

OK
...
AttributeError: type object 'Template' has no attribute 'original_render'

nosetests --with-django runs tests successfully

Dmitry Gladkov
  • 1,325
  • 1
  • 12
  • 24
  • I'm having exactly the same problem, any help would be greatly apperciated. – xaralis Sep 21 '10 at 13:18
  • Do you use tddpsry? I've got that error while running tests using django-nose and tddspry. I've added django-nose support to the tddspry itself and my changes were recently pulled into the main repo. Please take a look at "Running tests" section at the project page http://github.com/playpauseandstop/tddspry – Dmitry Gladkov Sep 21 '10 at 21:57
  • did you mean jbalogh's django-nose? Did you added it to INSTALLED_APPS and added TEST_RUNNER setting? – bx2 Sep 30 '10 at 15:15

1 Answers1

0

Turns out the problem was that I used tddspry with django-nose and they both has their own similar setup/teardown plugin, so I subclassed django-nose TestRunner and removed that plugin from defaults.

To solve this problem, install latest tddspry from official git repository, latest stable django-nose from PyPI and add tddspry TestSuiteRunner to Django settings as follows:

TEST_RUNNER = 'tddspry.django.runner.TestSuiteRunner'
Dmitry Gladkov
  • 1,325
  • 1
  • 12
  • 24