{"id":23608,"library":"django-test-without-migrations","title":"django-test-without-migrations","description":"Disables Django migrations when running tests, significantly speeding up test runs by using the current model state instead of running migrations. Version 0.6 is the latest, with no recent updates. Use it to avoid migration overhead in CI or local testing.","status":"active","version":"0.6","language":"python","source_language":"en","source_url":"https://github.com/henriquebastos/django-test-without-migrations","tags":["django","testing","migrations","performance"],"install":[{"cmd":"pip install django-test-without-migrations","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Correct import path for the mixin.","symbol":"TestWithoutMigrationsMixin","correct":"from django_test_without_migrations import TestWithoutMigrationsMixin"}],"quickstart":{"code":"# settings.py\nTEST_RUNNER = 'django_test_without_migrations.DjangoTestSuiteRunner'\n\n# Or use as a mixin in a test class:\nfrom django.test import TestCase\nfrom django_test_without_migrations import TestWithoutMigrationsMixin\n\nclass MyTestCase(TestWithoutMigrationsMixin, TestCase):\n    def test_something(self):\n        self.assertTrue(True)\n","lang":"python","description":"Two usage patterns: setting TEST_RUNNER globally, or mixing into individual test classes."},"warnings":[{"fix":"Run tests with migrations periodically (e.g., on CI) to catch migration issues.","message":"Disabling migrations means tables are created directly from models. Ensure your models match the expected schema, as any missing migrations (like field additions) will not be applied. This can mask migration bugs.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the mixin 'TestWithoutMigrationsMixin' instead of setting TEST_RUNNER if using Django 1.10+.","message":"Django 1.10+ deprecates the pattern of overriding TEST_RUNNER with a custom runner. The mixin approach is recommended for newer Django versions.","severity":"deprecated","affected_versions":"0.6"},{"fix":"Write a custom test runner that inherits from DjangoTestSuiteRunner and overrides setup_databases.","message":"If you have multiple databases, the TEST_RUNNER may not handle them correctly. You might need to extend the runner to support additional database aliases.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install the package: pip install django-test-without-migrations. Then use: from django_test_without_migrations import DjangoTestSuiteRunner","cause":"Using an incorrect import path or the package is not installed.","error":"ImportError: cannot import name 'DjangoTestSuiteRunner'"},{"fix":"Ensure you are using Django <= 1.10 for the TEST_RUNNER approach, or switch to the mixin pattern for later Django versions.","cause":"The test runner class has been misconfigured or an incorrect version of Django is used.","error":"AttributeError: 'DjangoTestSuiteRunner' object has no attribute 'setup_databases'"},{"fix":"Clear the test database or use the mixin pattern which creates tables from models without migrations.","cause":"Using TEST_RUNNER with a test database that has existing tables from migrations, causing conflict.","error":"django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}