在运行单元测试时禁用Django South ?

时间:2021-08-20 15:41:01

Disable Django South when running unit tests? How do you avoid running all of the south migrations when doing django unit testing?

在运行单元测试时禁用Django South ?在进行django单元测试时,如何避免运行所有的南方迁移?

2 个解决方案

#1


68  

Yes, the South documentation describes how to do it, but basically just add this to your settings.py file:

是的,南方的文档描述了如何做到这一点,但基本上只是将它添加到您的设置中。py文件:

SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead
SKIP_SOUTH_TESTS = True # To disable South's own unit tests

#2


31  

Even though, you have selected the good answer, I think that you should consider the option SOUTH_TESTS_MIGRATE instead. It will prevent to run all the migrations on your test db, and run syncdb instead.

尽管您已经选择了正确的答案,但我认为您应该考虑使用SOUTH_TESTS_MIGRATE选项。它将防止在测试db上运行所有迁移,而是运行syncdb。

#1


68  

Yes, the South documentation describes how to do it, but basically just add this to your settings.py file:

是的,南方的文档描述了如何做到这一点,但基本上只是将它添加到您的设置中。py文件:

SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead
SKIP_SOUTH_TESTS = True # To disable South's own unit tests

#2


31  

Even though, you have selected the good answer, I think that you should consider the option SOUTH_TESTS_MIGRATE instead. It will prevent to run all the migrations on your test db, and run syncdb instead.

尽管您已经选择了正确的答案,但我认为您应该考虑使用SOUTH_TESTS_MIGRATE选项。它将防止在测试db上运行所有迁移,而是运行syncdb。