django unit tests without a db

前端 未结 11 1492
醉梦人生
醉梦人生 2020-11-29 16:11

Is there a possibility to write django unittests without setting up a db? I want to test business logic which doesn\'t require the db to set up. And while it is fast to setu

11条回答
  •  执笔经年
    2020-11-29 16:47

    The above solutions are fine too. But the following solution will also reduce the db creation time if there are more number of migrations. During unit testing, running syncdb instead of running all the south migrations will be much faster.

    SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead

提交回复
热议问题