Skip to content

Commit

Permalink
Add test for pending migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
philgyford committed Jan 25, 2025
1 parent add3e8b commit a2d0e5f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_pending_migrations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from io import StringIO

from django.core.management import call_command
from django.test import TestCase


class PendingMigrationsTests(TestCase):
def test_no_pending_migrations(self):
# No migrations pending
# See: https://adamj.eu/tech/2024/06/23/django-test-pending-migrations/
out = StringIO()
try:
call_command("makemigrations", "--check", stdout=out, stderr=StringIO())
except SystemExit: # pragma: no cover
raise AssertionError("Pending migrations:\n" + out.getvalue()) from None

0 comments on commit a2d0e5f

Please sign in to comment.