Today I got into this problem. In the end, I ended up refactoring my migrations so that they use helper functions to actually insert the data, and then call the same functions from setUp () of my tests.
Some clues;
Make your helper functions a model class as an argument, so you can call them using orm ['yourapp.YourModel'] from the migration and using models. Your model from the test. This also shows a major limitation: South works for models whose layout has changed since then, test code cannot do this. I am fortunate that this particular model has not changed.
If you want to keep helper methods inside migrations, you will find that you cannot directly import yourapp.migrations.0001_some_migration, since identifiers cannot begin with numbers. Instead of the import statement, use migration_0001 = importlib.import_module('yourapp.migrations.0001_some_migration') .
source share