pytest-django and multiple DBs

Hey all.

For anyone who has two databases setup up and who uses a custom router to map models to one or the other:

If you’re using pytest and pytest-django, how do you configure your set up so that models are created in the correct database?

Why I run pytest, during test setup Django tries to create tables in the first database for all models. When I set breakdpoints in the methods of my custom router, the allow_migrate method is called, but the db_for_write method is never called, so Django never determines which db a model is meant for before trying to create a table (hence all tables are created in the first db).

Thanks for any thoughts.