Ticket #23305: ticket_23305.diff

File ticket_23305.diff, 2.8 KB (added by Schmitt Christian, 10 years ago)
  • new file tests/migrations/migrations_test_apps/invisible_migration_error/__init__.py

    diff --git a/tests/migrations/migrations_test_apps/invisible_migration_error/__init__.py b/tests/migrations/migrations_test_apps/invisible_migration_error/__init__.py
    new file mode 100644
    index 0000000..45c1f86
    - +  
     1from __future__ import absolute_import
     2from .models import Author
     3
     4default_app_config = 'migrations.migrations_test_apps.invisible_migration_error.apps.DemoConfig'
  • new file tests/migrations/migrations_test_apps/invisible_migration_error/apps.py

    diff --git a/tests/migrations/migrations_test_apps/invisible_migration_error/apps.py b/tests/migrations/migrations_test_apps/invisible_migration_error/apps.py
    new file mode 100644
    index 0000000..166b4c8
    - +  
     1from __future__ import absolute_import
     2
     3from django.apps import AppConfig
     4
     5
     6class DemoConfig(AppConfig):
     7    name = "migrations.migrations_test_apps.invisible_migration_error"
     8    label = 'custom_demo'
     9    verbose_name = "demo"
  • new file tests/migrations/migrations_test_apps/invisible_migration_error/models.py

    diff --git a/tests/migrations/migrations_test_apps/invisible_migration_error/migrations/__init__.py b/tests/migrations/migrations_test_apps/invisible_migration_error/migrations/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/migrations/migrations_test_apps/invisible_migration_error/models.py b/tests/migrations/migrations_test_apps/invisible_migration_error/models.py
    new file mode 100644
    index 0000000..12bd797
    - +  
     1from django.db import models
     2
     3
     4class Author(models.Model):
     5    name = models.CharField(max_length=255)
  • tests/migrations/test_commands.py

    diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
    index 2090135..54c1995 100644
    a b class MakeMigrationsTests(MigrationTestBase):  
    539539            questioner.input = old_input
    540540            if os.path.exists(merge_file):
    541541                os.remove(merge_file)
     542
     543    @override_system_checks([])
     544    @override_settings(
     545        INSTALLED_APPS=[
     546            "migrations.migrations_test_apps.invisible_migration_error", ])
     547    def test_makemigrations_ticket_23305(self):
     548        stdout = six.StringIO()
     549        call_command("makemigrations", stdout=stdout)
     550        initial_file = os.path.join(self.test_dir, "migrations_test_apps",
     551            "invisible_migration_error", "migrations", "0001_initial.py")
     552        file_exists = os.path.exists(initial_file)
     553        try:
     554            # Cleanup
     555            os.remove(initial_file)
     556        except:
     557            pass
     558        self.assertNotIn("No changes detected", stdout.getvalue())
     559        # Check for existing 0001_initial.py file in migration folder
     560        self.assertTrue(file_exists)
Back to Top