From 15d2f98980b5a2baea5e6c55cc2d42c848a19e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksi=20Ha=CC=88kli?= Date: Fri, 1 Feb 2019 18:19:15 +0200 Subject: [PATCH] Clean up database test case imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aleksi Häkli --- axes/tests/test_models.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/axes/tests/test_models.py b/axes/tests/test_models.py index 7d6df4f..4c311b1 100644 --- a/axes/tests/test_models.py +++ b/axes/tests/test_models.py @@ -1,27 +1,28 @@ +from django.apps.registry import apps +from django.db import connection +from django.db.migrations.autodetector import MigrationAutodetector +from django.db.migrations.executor import MigrationExecutor +from django.db.migrations.state import ProjectState from django.test import TestCase +from django.utils import translation class MigrationsCheck(TestCase): def setUp(self): - from django.utils import translation self.saved_locale = translation.get_language() translation.deactivate_all() def tearDown(self): if self.saved_locale is not None: - from django.utils import translation translation.activate(self.saved_locale) def test_missing_migrations(self): - from django.db import connection - from django.apps.registry import apps - from django.db.migrations.executor import MigrationExecutor executor = MigrationExecutor(connection) - from django.db.migrations.autodetector import MigrationAutodetector - from django.db.migrations.state import ProjectState autodetector = MigrationAutodetector( executor.loader.project_state(), ProjectState.from_apps(apps), ) + changes = autodetector.changes(graph=executor.loader.graph) + self.assertEqual({}, changes)