diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index 268e180697..33b85578af 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -373,6 +373,17 @@ class MigrateTests(MigrationTestBase): call_command('migrate', 'migrations', '0003', fake=True, verbosity=0) call_command('migrate', 'migrations', 'zero', verbosity=0) + @override_settings(MIGRATION_MODULES={'migrations': 'migrations.test_migrations_empty'}) + def test_showmigrations_no_migrations(self): + out = io.StringIO() + call_command('showmigrations', stdout=out, no_color=True) + self.assertEqual('migrations\n (no migrations)\n', out.getvalue().lower()) + + @override_settings(INSTALLED_APPS=['migrations.migrations_test_apps.unmigrated_app']) + def test_showmigrations_unmigrated_app(self): + with self.assertRaisesMessage(CommandError, 'No migrations present for: unmigrated_app'): + call_command('showmigrations', 'unmigrated_app') + @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_empty"}) def test_showmigrations_plan_no_migrations(self): """