From a48971931f59694bb8c99d3d0576c364ec3c7e3a Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Mon, 24 Jun 2024 17:37:08 -0400 Subject: [PATCH] test: add test for no pending migrations --- program/tests/test_migrations.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 program/tests/test_migrations.py diff --git a/program/tests/test_migrations.py b/program/tests/test_migrations.py new file mode 100644 index 00000000..3a00c22a --- /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 -- GitLab