Hi there,

I would like to test a django 1.2.3 application that uses both a sqlite db 
for auth/users, and an *unmanaged* postgres database for the application 
itself. Given that the models are unmanaged, and the postgres database has 
a very involved, long running set of scripts to build, the right approach 
seems to be to write a custom test runner which does not call create_test_db() 
but allows tests to run against an existing, pre-built test database.
The example I have been basing my custom test runner on is from 
django-test-utls 
https://raw.github.com/ericholscher/django-test-utils/master/test_utils/test_runners/keep_database.py

This seems to assume that the application only has one database however.

My no doubt imperfect understanding how how the test runner works, is that 
settings.DATABASES['default']['NAME'] is swapped out 
with settings.DATABASES['default']['TEST_NAME'], and then swapped back 
after unittest.TextTestRunner() is called. A point of confusion here is 
that connection.settings_dict['DATABASE_NAME'] only appears to take one 
database key.

Here is my test runner currently (default = sqlite, alt_db = pg):
https://gist.github.com/3174450

When my tests run at the moment, they fail with KeyError: 
'SUPPORTS_TRANSACTIONS'.

Is there some way that I can have the test runner create a test sqlite 
database, but also setup a connection to the existing test postgresql db?

Apologies if this all sounds a bit convoluted!

Many thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/0Py_0Ov9zXMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to