Skip to content

Instantly share code, notes, and snippets.

@jarshwah
Last active June 7, 2019 12:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarshwah/a3b3dfc0f7bc420b91971386a25837b1 to your computer and use it in GitHub Desktop.
Save jarshwah/a3b3dfc0f7bc420b91971386a25837b1 to your computer and use it in GitHub Desktop.
Unit test for confirming there are no outstanding migrations
from django.core.management import call_command
from django.test import TestCase
class MigrationsTestCase(TestCase):
def test_no_outstanding_migrations(self):
"""No migrations need to be generated"""
try:
result = call_command("makemigrations", "--dry-run", "--check", "--no-input", "-v", "0")
except SystemExit:
self.fail("There were outstanding migrations")
self.assertIsNone(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment