diff --git a/djangoproject/tests.py b/djangoproject/tests.py index 9e36f8e9e..bbf10b1d5 100644 --- a/djangoproject/tests.py +++ b/djangoproject/tests.py @@ -1,5 +1,7 @@ from http import HTTPStatus +from io import StringIO +from django.core.management import call_command from django.test import TestCase from django_hosts.resolvers import reverse @@ -114,3 +116,17 @@ def test_www_host_with_port(self): self.assertEqual(resp.status_code, HTTPStatus.OK) self.assertIn("Content-Language", resp) self.assertIn("Vary", resp) + + +class PendingMigrationsTests(TestCase): + def test_no_pending_migrations(self): + 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