I have written a example test and I'm trying to run it without creating a new database every time.
The first time I run my test everything is ok (takes sometime due to building the DB):
> 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 do I solve? 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'
Just use nose from github and you're good to go! I belive this is your issue:
https://github.com/jbalogh/django-nose/pull/95
I came across this a long while ago, it is now fixed on the github master, but unfortunately django-nose is not updated on pypi since last year..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With