Fix #112 -- make the behaviour of --include-migrations-from more obvious

* Misspelled filename => fail (instead of linting all migrations and ignoring the error)
* An empty file/a file with no valid migration paths => lint no migrations (instead oflinting all migrations)
* If the option is not specified, keep the behaviour of linting all migrations
This commit is contained in:
David Wobrock committed 2020-06-17 22:32:42 +02:00
1 parent 799957a556
commit 31338714dd
2 files changed
+22 -6

No files matched your search

+6 -2
View File
@@ -88,8 +88,12 @@ class LinterFunctionsTestCase(unittest.TestCase):
def test_read_migrations_unknown_file(self):
file_path = "unknown_file"
migration_list = MigrationLinter.read_migrations_list(file_path)
self.assertEqual([], migration_list)
with self.assertRaises(Exception):
MigrationLinter.read_migrations_list(file_path)
def test_read_migrations_no_file(self):
migration_list = MigrationLinter.read_migrations_list(None)
self.assertIsNone(migration_list)
def test_read_migrations_empty_file(self):
with tempfile.NamedTemporaryFile() as tmp: