From 859b4b3b1b216891f8212ee5639a0011d9d5a912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kr=C3=B6nke?= Date: Fri, 10 May 2019 16:50:56 +0200 Subject: [PATCH] fix tests --- django_migration_linter/migration_linter.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py index 3a9cfad..bac3752 100644 --- a/django_migration_linter/migration_linter.py +++ b/django_migration_linter/migration_linter.py @@ -97,7 +97,7 @@ class MigrationLinter(object): md5hash = self.get_migration_hash(app_label, migration_name) - if self.should_ignore_migration(migration): + if self.should_ignore_migration(app_label, migration_name, migration.operations): print("IGNORE") self.nb_ignored += 1 return @@ -232,13 +232,11 @@ class MigrationLinter(object): if app_label not in DJANGO_APPS_WITH_MIGRATIONS: yield migration - def should_ignore_migration(self, migration): - app_label = migration.app_label - migration_name = migration.name + def should_ignore_migration(self, app_label, migration_name, operations=()): return ( (self.include_apps and app_label not in self.include_apps) or (self.exclude_apps and app_label in self.exclude_apps) - or (any([isinstance(o, IgnoreMigration) for o in migration.operations])) + or (any([isinstance(o, IgnoreMigration) for o in operations])) or ( self.ignore_name_contains and self.ignore_name_contains in migration_name