Add internal classes and add type hints + mypy.
This commit is contained in:
1 parent
847ac1241a
commit
2ee7dac3b3
88 files changed
+603
-340
No files matched your search
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
CREATE_TABLE_WITH_NOT_NULL_COLUMN = "app_create_table_with_not_null_column"
|
||||
ADD_NOT_NULL_COLUMN = "app_add_not_null_column"
|
||||
DROP_COLUMN = "app_drop_column"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import unittest.mock as mock
|
||||
@@ -7,6 +9,7 @@ from django.db.migrations import Migration
|
||||
|
||||
from django_migration_linter import (
|
||||
IgnoreMigration,
|
||||
Issue,
|
||||
MigrationLinter,
|
||||
analyse_sql_statements,
|
||||
get_migration_abspath,
|
||||
@@ -29,7 +32,7 @@ class CacheTestCase(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
def test_cache_normal(self, *args):
|
||||
linter = MigrationLinter(self.test_project_path)
|
||||
linter = MigrationLinter(self.test_project_path, database="mysql")
|
||||
linter.old_cache.clear()
|
||||
linter.old_cache.save()
|
||||
|
||||
@@ -43,22 +46,20 @@ class CacheTestCase(unittest.TestCase):
|
||||
cache = linter.new_cache
|
||||
cache.load()
|
||||
|
||||
self.assertEqual("OK", cache["4a3770a405738d457e2d23e17fb1f3aa"]["result"])
|
||||
self.assertEqual("ERR", cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["result"])
|
||||
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"])
|
||||
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"])
|
||||
self.assertListEqual(
|
||||
[
|
||||
{
|
||||
"msg": "NOT NULL constraint on columns",
|
||||
"code": "NOT_NULL",
|
||||
"table": None,
|
||||
"column": None,
|
||||
}
|
||||
Issue(
|
||||
code="NOT_NULL",
|
||||
message="NOT NULL constraint on columns",
|
||||
),
|
||||
],
|
||||
cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["errors"],
|
||||
cache["52000d9d2c43dfda982945000dc6ba54"]["errors"],
|
||||
)
|
||||
|
||||
# Start the Linter again -> should use cache now.
|
||||
linter = MigrationLinter(self.test_project_path)
|
||||
linter = MigrationLinter(self.test_project_path, database="mysql")
|
||||
|
||||
with mock.patch(
|
||||
"django_migration_linter.migration_linter.analyse_sql_statements",
|
||||
@@ -95,18 +96,16 @@ class CacheTestCase(unittest.TestCase):
|
||||
cache = linter.new_cache
|
||||
cache.load()
|
||||
|
||||
self.assertEqual("OK", cache["4a3770a405738d457e2d23e17fb1f3aa"]["result"])
|
||||
self.assertEqual("ERR", cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["result"])
|
||||
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"])
|
||||
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"])
|
||||
self.assertListEqual(
|
||||
[
|
||||
{
|
||||
"msg": "NOT NULL constraint on columns",
|
||||
"code": "NOT_NULL",
|
||||
"table": None,
|
||||
"column": None,
|
||||
}
|
||||
Issue(
|
||||
code="NOT_NULL",
|
||||
message="NOT NULL constraint on columns",
|
||||
),
|
||||
],
|
||||
cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["errors"],
|
||||
cache["52000d9d2c43dfda982945000dc6ba54"]["errors"],
|
||||
)
|
||||
|
||||
# Start the Linter again but with different database, should not be the same cache
|
||||
@@ -122,18 +121,16 @@ class CacheTestCase(unittest.TestCase):
|
||||
cache = linter.new_cache
|
||||
cache.load()
|
||||
|
||||
self.assertEqual("OK", cache["4a3770a405738d457e2d23e17fb1f3aa"]["result"])
|
||||
self.assertEqual("ERR", cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["result"])
|
||||
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"])
|
||||
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"])
|
||||
self.assertListEqual(
|
||||
[
|
||||
{
|
||||
"msg": "NOT NULL constraint on columns",
|
||||
"code": "NOT_NULL",
|
||||
"table": None,
|
||||
"column": None,
|
||||
}
|
||||
Issue(
|
||||
code="NOT_NULL",
|
||||
message="NOT NULL constraint on columns",
|
||||
),
|
||||
],
|
||||
cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["errors"],
|
||||
cache["52000d9d2c43dfda982945000dc6ba54"]["errors"],
|
||||
)
|
||||
|
||||
self.assertTrue(linter.has_errors)
|
||||
@@ -169,7 +166,7 @@ class CacheTestCase(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
def test_cache_modified(self, *args):
|
||||
linter = MigrationLinter(self.test_project_path)
|
||||
linter = MigrationLinter(self.test_project_path, database="mysql")
|
||||
linter.old_cache.clear()
|
||||
linter.old_cache.save()
|
||||
|
||||
@@ -183,7 +180,7 @@ class CacheTestCase(unittest.TestCase):
|
||||
cache = linter.new_cache
|
||||
cache.load()
|
||||
|
||||
self.assertEqual("ERR", cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["result"])
|
||||
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"])
|
||||
|
||||
# Get the content of the migration file and mock the open call to append
|
||||
# some content to change the hash
|
||||
@@ -209,9 +206,9 @@ class CacheTestCase(unittest.TestCase):
|
||||
cache = linter.new_cache
|
||||
cache.load()
|
||||
|
||||
self.assertNotIn("19fd3ea688fc05e2cc2a6e67c0b7aa17", cache)
|
||||
self.assertNotIn("52000d9d2c43dfda982945000dc6ba54", cache)
|
||||
self.assertEqual(1, len(cache))
|
||||
self.assertEqual("ERR", cache["a25768641a0ad526fad199f97c303784"]["result"])
|
||||
self.assertEqual("ERR", cache["edeb40ecc1f5550ebef876c8e8ca093d"]["result"])
|
||||
|
||||
@mock.patch(
|
||||
"django_migration_linter.MigrationLinter._gather_all_migrations",
|
||||
@@ -221,7 +218,7 @@ class CacheTestCase(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
def test_ignore_cached_migration(self, *args):
|
||||
linter = MigrationLinter(self.test_project_path)
|
||||
linter = MigrationLinter(self.test_project_path, database="mysql")
|
||||
linter.old_cache.clear()
|
||||
linter.old_cache.save()
|
||||
|
||||
@@ -235,23 +232,23 @@ class CacheTestCase(unittest.TestCase):
|
||||
cache = linter.new_cache
|
||||
cache.load()
|
||||
|
||||
self.assertEqual("OK", cache["4a3770a405738d457e2d23e17fb1f3aa"]["result"])
|
||||
self.assertEqual("ERR", cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["result"])
|
||||
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"])
|
||||
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"])
|
||||
self.assertListEqual(
|
||||
[
|
||||
{
|
||||
"msg": "NOT NULL constraint on columns",
|
||||
"code": "NOT_NULL",
|
||||
"table": None,
|
||||
"column": None,
|
||||
}
|
||||
Issue(
|
||||
code="NOT_NULL",
|
||||
message="NOT NULL constraint on columns",
|
||||
),
|
||||
],
|
||||
cache["19fd3ea688fc05e2cc2a6e67c0b7aa17"]["errors"],
|
||||
cache["52000d9d2c43dfda982945000dc6ba54"]["errors"],
|
||||
)
|
||||
|
||||
# Start the Linter again -> should use cache now but ignore the erroneous
|
||||
linter = MigrationLinter(
|
||||
self.test_project_path, ignore_name_contains="0002_add_new_not_null_field"
|
||||
self.test_project_path,
|
||||
ignore_name_contains="0002_add_new_not_null_field",
|
||||
database="mysql",
|
||||
)
|
||||
|
||||
with mock.patch(
|
||||
@@ -266,4 +263,4 @@ class CacheTestCase(unittest.TestCase):
|
||||
cache = linter.new_cache
|
||||
cache.load()
|
||||
self.assertEqual(1, len(cache))
|
||||
self.assertEqual("OK", cache["4a3770a405738d457e2d23e17fb1f3aa"]["result"])
|
||||
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"])
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
@@ -307,13 +309,13 @@ class RunSQLMigrationTestCase(unittest.TestCase):
|
||||
runsql = migrations.RunSQL("sql;")
|
||||
|
||||
error, ignored, warning = self.linter.lint_runsql(runsql)
|
||||
self.assertEqual("RUNSQL_REVERSIBLE", warning[0]["code"])
|
||||
self.assertEqual("RUNSQL_REVERSIBLE", warning[0].code)
|
||||
|
||||
def test_sql_linting_error(self):
|
||||
runsql = migrations.RunSQL("ALTER TABLE t DROP COLUMN t;")
|
||||
|
||||
error, ignored, warning = self.linter.lint_runsql(runsql)
|
||||
self.assertEqual("DROP_COLUMN", error[0]["code"])
|
||||
self.assertEqual("DROP_COLUMN", error[0].code)
|
||||
|
||||
def test_sql_linting_error_array(self):
|
||||
runsql = migrations.RunSQL(
|
||||
@@ -321,11 +323,11 @@ class RunSQLMigrationTestCase(unittest.TestCase):
|
||||
)
|
||||
|
||||
error, ignored, warning = self.linter.lint_runsql(runsql)
|
||||
self.assertEqual("DROP_COLUMN", error[0]["code"])
|
||||
self.assertEqual("RENAME_COLUMN", error[1]["code"])
|
||||
self.assertEqual("DROP_COLUMN", error[0].code)
|
||||
self.assertEqual("RENAME_COLUMN", error[1].code)
|
||||
|
||||
def test_sql_linting_error_args(self):
|
||||
runsql = migrations.RunSQL([("ALTER TABLE %s DROP COLUMN %s;", ("t", "c"))])
|
||||
|
||||
error, ignored, warning = self.linter.lint_runsql(runsql)
|
||||
self.assertEqual("DROP_COLUMN", error[0]["code"])
|
||||
self.assertEqual("DROP_COLUMN", error[0].code)
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.core.management import call_command
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2019-09-20 20:01
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2019-09-20 20:02
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-19 20:59
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-19 21:05
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 14:54
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 14:55
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
from django_add_default_value import AddDefaultValue
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 14:56
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 14:56
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-19 20:59
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-19 21:05
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-19 21:08
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-19 21:08
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 14:59
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-01-26 17:43
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-01-26 17:43
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-01-26 17:47
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 14:59
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 14:59
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 14:59
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.10 on 2019-07-19 09:50
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from django.db import models
|
||||
# from django.db import models
|
||||
|
||||
# class A(models.Model):
|
||||
# field_a = models.IntegerField()
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-21 20:40
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-21 20:41
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import django_migration_linter as linter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-06-20 15:17
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-06-20 15:17
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-06-20 15:23
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-06-20 15:23
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
from django_add_default_value import AddDefaultValue
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 15:02
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 15:02
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 15:00
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Generated by Django 1.11.18 on 2019-04-14 15:00
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2019-07-29 21:21
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2019-07-29 21:22
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2019-07-29 21:22
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-06-26 17:49
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Generated by Django 2.2 on 2020-06-26 15:57
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.1/ref/settings/
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
from collections import OrderedDict
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from django_migration_linter.sql_analyser import (
|
||||
@@ -28,9 +30,9 @@ class SqlAnalyserTestCase(unittest.TestCase):
|
||||
self.assertNotEqual(0, len(errors), "Found no errors in sql")
|
||||
if code:
|
||||
self.assertTrue(
|
||||
any(err["code"] == code for err in errors),
|
||||
any(err.code == code for err in errors),
|
||||
"Didn't find error code {} in returned errors ({})".format(
|
||||
code, [err["code"] for err in errors]
|
||||
code, [err.code for err in errors]
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from django_migration_linter.utils import split_migration_path, split_path
|
||||
|
||||
Reference in new issue
Block a user