How do I use models with different properties for testing purposes?

Edit: My apologies if this was posted in the wrong board. This is either about migrations/db backends or it’s about using Django, but after I posted I realized it might lean more towards the latter.

Issue: My models have managed = False in the meta, which means when I run tests, no new tables can be created. I thought I solved it by doing the below:

  1. Make a test_migrations folder within my module folder.
  2. Put my migrations file in there with managed = False commented out
  3. Putting the below into my
if 'test' in sys.argv:
        'webapi': 'webapi.test_migrations',

I guess what’s happening is that when I run tests, the tests cannot execute “makemigrations” so this strategy is failing. I’m pretty sure?? My _meta.managed is still False when I do this.

I also tried changing _meta.managed = True right in the tests, but I’m not sure when Django uses this property to check if it is allowed to make tables or not, so ultimately I think it failed.

Any hints?

It would be better to put the question in “Using Django” category.

The best way to test that is to have table DDL script (SQL) and load/create table before run tests. It will exactly simulate what you have on production.
Other way is to try mock some methods you will call.