Django Testing: DatabaseCreation 'object does not have' _rollback_works' attribute

I wrote an example test, and I try to run it without creating a new database every time.

The first time I run my test, everything is fine (it was required sometime due to the creation of the database):

> REUSE_DB=1 python manage.py test contacts Ran 1 test in 0.251s 

The second time I get the following error:

 > REUSE_DB=1 python manage.py test contacts nosetests --verbosity 1 contacts AttributeError: 'DatabaseCreation' object has no attribute '_rollback_works' 

Why and how can I decide? Thanks.

My test:

 class ExampleTestCase(TestCase): def test_contact_page(self): resp = self.client.get('/contact/single/') self.assertEqual(resp.status_code, 200) 

Settings.py

 DEBUG = True TEMPLATE_DEBUG = DEBUG INSTALLED_APPS += ( 'django_nose', ) TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' 
+7
source share
1 answer

Just use your github nose and you're good to go! I believe this is your problem:

https://github.com/jbalogh/django-nose/pull/95

I came across this a long time ago, now it is fixed for the github master, but, unfortunately, the django nose has not been updated on pypi since last year.

+4
source

All Articles