diff --git a/tests/test_project_fixtures/test_correct_project/apps/__init__.py b/tests/test_project_fixtures/test_correct_project/apps/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_correct_project/apps/test_app3/__init__.py b/tests/test_project_fixtures/test_correct_project/apps/test_app3/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_correct_project/apps/test_app3/admin.py b/tests/test_project_fixtures/test_correct_project/apps/test_app3/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project_fixtures/test_correct_project/apps/test_app3/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project_fixtures/test_correct_project/apps/test_app3/apps.py b/tests/test_project_fixtures/test_correct_project/apps/test_app3/apps.py new file mode 100644 index 0000000..7a1fd83 --- /dev/null +++ b/tests/test_project_fixtures/test_correct_project/apps/test_app3/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TestApp3Config(AppConfig): + name = 'test_app3' diff --git a/tests/test_project_fixtures/test_correct_project/apps/test_app3/migrations/0001_initial.py b/tests/test_project_fixtures/test_correct_project/apps/test_app3/migrations/0001_initial.py new file mode 100644 index 0000000..beaa780 --- /dev/null +++ b/tests/test_project_fixtures/test_correct_project/apps/test_app3/migrations/0001_initial.py @@ -0,0 +1,21 @@ +# Generated by Django 2.1.4 on 2019-01-04 20:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='C', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('not_null_field', models.IntegerField()), + ], + ), + ] diff --git a/tests/test_project_fixtures/test_correct_project/apps/test_app3/migrations/__init__.py b/tests/test_project_fixtures/test_correct_project/apps/test_app3/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_correct_project/apps/test_app3/models.py b/tests/test_project_fixtures/test_correct_project/apps/test_app3/models.py new file mode 100644 index 0000000..0124f42 --- /dev/null +++ b/tests/test_project_fixtures/test_correct_project/apps/test_app3/models.py @@ -0,0 +1,4 @@ +from django.db import models + +class C(models.Model): + not_null_field = models.IntegerField(null=False) diff --git a/tests/test_project_fixtures/test_correct_project/apps/test_app3/tests.py b/tests/test_project_fixtures/test_correct_project/apps/test_app3/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project_fixtures/test_correct_project/apps/test_app3/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project_fixtures/test_correct_project/apps/test_app3/views.py b/tests/test_project_fixtures/test_correct_project/apps/test_app3/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project_fixtures/test_correct_project/apps/test_app3/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/tests/test_project_fixtures/test_correct_project/test_project/settings.py b/tests/test_project_fixtures/test_correct_project/test_project/settings.py index f0642cc..8145e44 100644 --- a/tests/test_project_fixtures/test_correct_project/test_project/settings.py +++ b/tests/test_project_fixtures/test_correct_project/test_project/settings.py @@ -11,10 +11,12 @@ https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os +import sys # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ @@ -38,7 +40,8 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'test_app1', - 'test_app2' + 'test_app2', + 'apps.test_app3', ] MIDDLEWARE = [ diff --git a/tests/unit/test_linter.py b/tests/unit/test_linter.py index 5b3c4a5..d9cbdaa 100644 --- a/tests/unit/test_linter.py +++ b/tests/unit/test_linter.py @@ -80,12 +80,13 @@ class TestLinterFunctions(unittest.TestCase): def test_gather_all_migrations(self): linter = MigrationLinter(fixtures.CORRECT_PROJECT) migrations = linter._gather_all_migrations() - self.assertEqual(len(migrations), 3) + self.assertEqual(len(migrations), 4) self.assertEqual( sorted(migrations), sorted([ ("test_app1", "0001_initial"), ("test_app1", "0002_a_new_null_field"), ("test_app2", "0001_foo"), + ("test_app3", "0001_initial"), ]) )