Tuesday, May 29, 2018

multidb, don't create one of them during unit tests

I'm using Django's (1.11) typical default db for my regular Django development, but I need to integrate with someone else's bugzilla db server running on mysql somewhere else (no web api available, mysql is the recommendation from them).     So I've added a 2nd DB to my DB config pointing to their server.  I've used inspectdb to bring in their schema as models.

They have both a production instance and a test instance for reading bugs.  These are both read only.

I'd like my unit tests to skip creating the test instance of their DB (since I'm not even running a mysql server to use, I don't have write access to theirs, and their test instance is already populated) and to just point my unit tests at their test instance.

I see I can override the TestRunner ....

https://stackoverflow.com/questions/5917587/django-unit-tests-without-a-db

setup_databases in django.test.utils seems to take a global for keepdb so it doesn't seem like someone can choose on a per db basis ...

Is this possible?  How?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/61d4c77e-2c5c-4afc-829d-3a1723d5cb2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment