Why do migrations run faster under `./manage.py test` compared with `./manage.py migrate`?

Why do migrations run faster under ./manage.py test compared with ./manage.py migrate (on a fresh database)? I'm not running an in memory database for unit tests or anything like that. Both the proper app and the unit test db use the same mysql docker container. I am using the NoseTestRunner.

This came up because I am trying use the Pytest runner but I found that it was much slower.

I know that ./manage.py test is in fact running the migrations, there are no shortcuts like that.

I have not technically verified that all cases run the same number of migrations.

I'm guessing some database optimization is being applied, like removing constraints or something.

I have these two dependencies installed. django-nose==1.4.7 Django==3.2.25

Вернуться на верх