I\'m trying to write test cases for my django project but when I run \"$ ./manage.py test\" command its creating test database but its not creating any tables and I\'m gett
add --nomigrations to your pytest.ini
or setup.cfg
- wherever your pytest settings live:
[pytest]
addopts = --nomigrations
and add this to your top-level conftest.py
@pytest.fixture(autouse=True, scope="session")
def django_test_environment(django_test_environment):
from django.apps import apps
get_models = apps.get_models
for m in [m for m in get_models() if not m._meta.managed]:
m._meta.managed = True
It will do the magic