It seems that out of all migrations, data migrations don’t seems to be applied when testing. It’s there a way to make this not to be this way? I understand that fixtures is a solution, but in this particular use case we went with data migration because we could reason with the code while developing, and now that we are trying to test, we stumbled into this step.
Note, normal migrations seems to create the records just fine, test however seems to noop and none of the TestCase sub-classes seems to indicate that they would behave differently.
If fixtures is the only option, is there a way to keep them in sync with our data migration code?
Well, from what I remember, from that the last time that I had data migrations all of them were running, and in that particular case i had to deactivate it.
I was using pytest and pytest-django as well, so it may be the difference on these scenarios.
I’ve installed and used pytest. Still same behavior, even if I pass --migrations. The interesting thing is that there’s a test that says that at least 1 exists, while the other test says that none exists.
I found the problem, I was creating the record and testing it with an user that was set as not active, which somehow results in User.objects.get() returning nothing, which is not documented anywhere nor there’s indications in the code that the manager overrides the get method. Now to figure out why it says permissions doesn’t exists when I’m passing the correct strings.