I'm looking for a way to run a full celery setup during django tests, asked in this other SO question
After thinking about it, I think I could settle for running a unittest (it's more of an integration test) in which I run the test script against the main Django (development) database. Is there a way to write unittests, run them with Nose and do so against the main database? I imagine it would be a matter of telling Nose (or whatever other framework) about the django settings.
I've looked at django-nose
but wasn't able to find a way to tell it to use the main DB and not a test one.
Have you had a look at django-nose? It seems like it would be the right tool for the job.
I don't know about nose, but here is how to run against and existing db with django (1.6) unit tests.
Then in settings.py
It will be a little different in older versions of django. Also, you may need to override _fixture_setup and _fixture_teardown in your test cases to pass.
The above code will connect to a preexisting database but since each test is wrapped in a transaction the changes won't be available to other connections (like the celery worker). The easiest way to disable transactions is to subclass from
unittest.TestCase
instead ofdjango.test.TestCase
.