diff --git a/program/tests/test_migrations.py b/program/tests/test_migrations.py new file mode 100644 index 0000000000000000000000000000000000000000..3a00c22af1f4939741b3eb47c758541a419eb56c --- /dev/null +++ b/program/tests/test_migrations.py @@ -0,0 +1,15 @@ +import pytest + +from django.core.management import call_command + +pytestmark = pytest.mark.django_db + + +# adapted from https://adamj.eu/tech/2024/06/23/django-test-pending-migrations/ for pytest +def test_no_pending_migrations(capsys): + try: + call_command("makemigrations", "--dry-run", "--check") + except SystemExit: # pragma: no cover + out, _ = capsys.readouterr() + + raise AssertionError("Pending migrations:\n" + out) from None