Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Django South when running unit tests?

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

like image 434
MikeN Avatar asked Apr 27 '11 01:04

MikeN


People also ask

How do I stop Django migration?

You can selectively disable migration for one or more Django-Models by setting managed = False in Django Model Meta options.

Does Django use Unittest?

Writing testsDjango's unit tests use a Python standard library module: unittest . This module defines tests using a class-based approach. When you run your tests, the default behavior of the test utility is to find all the test cases (that is, subclasses of unittest.

How do I test migrations in Django?

django-test-migrationsSet some migration as a starting point. Create some model's data that you want to test. Run the new migration that you are testing. Assert the results!


1 Answers

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

SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead SKIP_SOUTH_TESTS = True # To disable South's own unit tests 
like image 57
Andrew C Avatar answered Oct 04 '22 03:10

Andrew C