Skip to content
Snippets Groups Projects
Commit 62a9dd61 authored by Ben Patterson's avatar Ben Patterson
Browse files

Ensure makemigrations test is called.

parent 6b40e6f2
No related merge requests found
...@@ -4,14 +4,13 @@ import ddt ...@@ -4,14 +4,13 @@ import ddt
import threading import threading
import time import time
import unittest import unittest
from unittest import skipIf
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.management import call_command from django.core.management import call_command
from django.conf import settings
from django.db import connection, IntegrityError from django.db import connection, IntegrityError
from django.db.transaction import atomic, TransactionManagementError from django.db.transaction import atomic, TransactionManagementError
from django.test import TestCase, TransactionTestCase from django.test import TestCase, TransactionTestCase
from django.test.utils import override_settings
from util.db import ( from util.db import (
commit_on_success, enable_named_outer_atomic, outer_atomic, generate_int_id, NoOpMigrationModules commit_on_success, enable_named_outer_atomic, outer_atomic, generate_int_id, NoOpMigrationModules
...@@ -215,11 +214,14 @@ class MigrationTests(TestCase): ...@@ -215,11 +214,14 @@ class MigrationTests(TestCase):
""" """
Tests for migrations. Tests for migrations.
""" """
@skipIf(isinstance(settings.MIGRATION_MODULES, NoOpMigrationModules), 'Skip in case of NoOpMigrationModules') @override_settings(MIGRATION_MODULES={})
def test_migrations_are_in_sync(self): def test_migrations_are_in_sync(self):
""" """
Tests that the migration files are in sync with the models. Tests that the migration files are in sync with the models.
If this fails, you needs to run the Django command makemigrations. If this fails, you needs to run the Django command makemigrations.
The test is set up to override MIGRATION_MODULES to ensure migrations are
enabled for purposes of this test regardless of the overall test settings.
""" """
with self.assertRaises(SystemExit): with self.assertRaises(SystemExit):
call_command('makemigrations', '-e') call_command('makemigrations', '-e')
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment