From 9c711ee3a6a638add26d19dad70447c981371598 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 9 Aug 2013 09:12:15 -0400 Subject: [PATCH] Fixed test failures on Python 3 - refs #12288 --- django/conf/__init__.py | 6 ++++-- tests/settings_tests/tests.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/django/conf/__init__.py b/django/conf/__init__.py index e628af748c..199c34fb55 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -107,8 +107,10 @@ class BaseSettings(object): elif name == "ALLOWED_INCLUDE_ROOTS" and isinstance(value, six.string_types): raise ValueError("The ALLOWED_INCLUDE_ROOTS setting must be set " "to a tuple, not a string.") - elif name == "INSTALLED_APPS" and len(value) != len(set(value)): - raise ImproperlyConfigured("The INSTALLED_APPS setting must contain unique values.") + elif name == "INSTALLED_APPS": + value = list(value) # force evaluation of generators on Python 3 + if len(value) != len(set(value)): + raise ImproperlyConfigured("The INSTALLED_APPS setting must contain unique values.") object.__setattr__(self, name, value) diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py index 4031d09a58..a9503358a2 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -226,7 +226,7 @@ class TestComplexSettingOverride(TestCase): self.assertEqual('Overriding setting TEST_WARN can lead to unexpected behaviour.', str(w[-1].message)) -class UniqueSettngsTests(TestCase): +class UniqueSettingsTests(TestCase): """ Tests for the INSTALLED_APPS setting. """