summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Heap <tim@timheap.me>2014-11-11 15:41:55 +1100
committerTim Graham <timograham@gmail.com>2014-11-28 07:48:39 -0500
commitdeb607648ed7d484a90474b6da48642b4f39bca7 (patch)
treef9728781a87ed9b8f708aa9803c19c3607c7e0e0 /tests
parentab89414f40db1598364a7fe4cfac1766cacd2668 (diff)
Fixed #23728 -- Added the --exit option to makemigrations.
If no changes that need migrations are found, `makemigrations --exit` exits with error code 1.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_commands.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index ddbcfb343a..5995468e98 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -543,6 +543,18 @@ class MakeMigrationsTests(MigrationTestBase):
self.assertIn("dependencies=[\n('migrations','0001_%s'),\n]" % migration_name_0001, content)
self.assertIn("operations=[\n]", content)
+ def test_makemigrations_exit(self):
+ """
+ makemigrations --exit should exit with sys.exit(1) when there are no
+ changes to an app.
+ """
+ with self.settings(MIGRATION_MODULES={"migrations": self.migration_pkg}):
+ call_command("makemigrations", "--exit", "migrations", verbosity=0)
+
+ with self.settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_no_changes"}):
+ with self.assertRaises(SystemExit):
+ call_command("makemigrations", "--exit", "migrations", verbosity=0)
+
class SquashMigrationsTest(MigrationTestBase):
"""