From b329271b81648135183c305abd18f4a1d5d0f0fe Mon Sep 17 00:00:00 2001 From: m-vdb Date: Fri, 22 Jul 2016 08:40:50 -0700 Subject: [PATCH 1/3] django.db.models.loading.get_models => django.apps.apps.get_models --- lettuce/django/steps/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lettuce/django/steps/models.py b/lettuce/django/steps/models.py index f4aa31092..e34e3b7f5 100644 --- a/lettuce/django/steps/models.py +++ b/lettuce/django/steps/models.py @@ -8,7 +8,11 @@ from django.core.management import call_command from django.core.management.color import no_style from django.db import connection -from django.db.models.loading import get_models +try: + from django.db.models.loading import get_models +except ImportError: + from django.apps import apps + get_models = apps.get_models from django.utils.functional import curry from functools import wraps From 9124dc1e83266f4ff5dc83bbcaa421536d465773 Mon Sep 17 00:00:00 2001 From: m-vdb Date: Fri, 22 Jul 2016 08:44:01 -0700 Subject: [PATCH 2/3] requires_model_validation -> requires_system_checks in Django==1.9 --- lettuce/django/management/commands/harvest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lettuce/django/management/commands/harvest.py b/lettuce/django/management/commands/harvest.py index 4ac86ea08..2b38c972d 100644 --- a/lettuce/django/management/commands/harvest.py +++ b/lettuce/django/management/commands/harvest.py @@ -36,7 +36,7 @@ class Command(BaseCommand): help = u'Run lettuce tests all along installed apps' args = '[PATH to feature file or folder]' - requires_model_validation = False + requires_model_validation = requires_system_checks = False option_list = BaseCommand.option_list + ( make_option('-a', '--apps', action='store', dest='apps', default='', From 1a8e845ecfd0b663161c6e5229954fc6b34bdb85 Mon Sep 17 00:00:00 2001 From: m-vdb Date: Fri, 22 Jul 2016 15:16:35 -0700 Subject: [PATCH 3/3] accept list and tupls for LETTUCE_APPS and LETTUCE_AVOID_APPS --- lettuce/django/apps.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lettuce/django/apps.py b/lettuce/django/apps.py index e518c6fac..0ca18407a 100644 --- a/lettuce/django/apps.py +++ b/lettuce/django/apps.py @@ -32,7 +32,7 @@ def _filter_bultins(module): def _filter_configured_apps(module): "returns only those apps that are in django.conf.settings.LETTUCE_APPS" app_found = True - if hasattr(settings, 'LETTUCE_APPS') and isinstance(settings.LETTUCE_APPS, tuple): + if hasattr(settings, 'LETTUCE_APPS') and isinstance(settings.LETTUCE_APPS, (list, tuple)): app_found = False for appname in settings.LETTUCE_APPS: if module.__name__.startswith(appname): @@ -44,7 +44,7 @@ def _filter_configured_apps(module): def _filter_configured_avoids(module): "returns apps that are not within django.conf.settings.LETTUCE_AVOID_APPS" run_app = False - if hasattr(settings, 'LETTUCE_AVOID_APPS') and isinstance(settings.LETTUCE_AVOID_APPS, tuple): + if hasattr(settings, 'LETTUCE_AVOID_APPS') and isinstance(settings.LETTUCE_AVOID_APPS, (list, tuple)): for appname in settings.LETTUCE_AVOID_APPS: if module.__name__.startswith(appname): run_app = True @@ -73,7 +73,7 @@ def harvest_lettuces(only_the_apps=None, avoid_apps=None, path="features"): apps = get_apps() - if isinstance(only_the_apps, tuple) and any(only_the_apps): + if isinstance(only_the_apps, (list, tuple)) and any(only_the_apps): def _filter_only_specified(module): return module.__name__ in only_the_apps @@ -83,7 +83,7 @@ def _filter_only_specified(module): apps = filter(_filter_configured_apps, apps) apps = filter(_filter_configured_avoids, apps) - if isinstance(avoid_apps, tuple) and any(avoid_apps): + if isinstance(avoid_apps, (list, tuple)) and any(avoid_apps): def _filter_avoid(module): return module.__name__ not in avoid_apps