Commits

Carl Meyer committed ab7312d

Dropped support for obsolete Python 2.5 and Django 1.1.

  • Participants
  • Parent commits 48ad311

Comments (0)

Files changed (3)

 tip (unreleased)
 ----------------
 
+- Dropped support for Python 2.5 and Django 1.1. Both are no longer supported
+  even for security fixes, and should not be used.
+
 - Added ``PassThroughManager.for_queryset_class()``, which fixes use of
   ``PassThroughManager`` with related fields. Thanks Ryan Kaskel for report and
   fix.

File model_utils/tests/tests.py

 from __future__ import with_statement
 
-import pickle, sys, warnings
+import pickle, warnings
 
 from datetime import datetime, timedelta
 
-import django
-from django.test import TestCase
 from django.db import models
 from django.db.models.fields import FieldDoesNotExist
 from django.core.exceptions import ImproperlyConfigured
+from django.test import TestCase
 
 from django.contrib.contenttypes.models import ContentType
 
         self.assertEquals(obj.__class__, InheritChild)
 
 
-    # @@@ Use proper test skipping once Django 1.2 is minimum supported version.
-    if sys.version_info >= (2, 6):
-        # @@@ catch_warnings only available in Python 2.6 and newer
-        def test_pending_deprecation(self):
-            with warnings.catch_warnings(record=True) as w:
-                warnings.simplefilter("always")
-                InheritParent()
-                self.assertEqual(len(w), 1)
-                assert issubclass(w[-1].category, PendingDeprecationWarning)
+    def test_pending_deprecation(self):
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            InheritParent()
+            self.assertEqual(len(w), 1)
+            assert issubclass(w[-1].category, PendingDeprecationWarning)
 
 
 
 
 
 
-# @@@ Use proper test skipping once 1.2 is minimum supported version.
-if django.VERSION >= (1, 2):
-    class InheritanceManagerTests(TestCase):
-        def setUp(self):
-            self.child1 = InheritanceManagerTestChild1.objects.create()
-            self.child2 = InheritanceManagerTestChild2.objects.create()
+class InheritanceManagerTests(TestCase):
+    def setUp(self):
+        self.child1 = InheritanceManagerTestChild1.objects.create()
+        self.child2 = InheritanceManagerTestChild2.objects.create()
 
 
-        def get_manager(self):
-            return InheritanceManagerTestParent.objects
+    def get_manager(self):
+        return InheritanceManagerTestParent.objects
 
 
-        def test_normal(self):
-            self.assertEquals(set(self.get_manager().all()),
-                              set([
-                        InheritanceManagerTestParent(pk=self.child1.pk),
-                        InheritanceManagerTestParent(pk=self.child2.pk),
-                        ]))
+    def test_normal(self):
+        self.assertEquals(set(self.get_manager().all()),
+                          set([
+                    InheritanceManagerTestParent(pk=self.child1.pk),
+                    InheritanceManagerTestParent(pk=self.child2.pk),
+                    ]))
 
 
-        def test_select_all_subclasses(self):
-            self.assertEquals(
-                set(self.get_manager().select_subclasses()),
-                set([self.child1, self.child2]))
+    def test_select_all_subclasses(self):
+        self.assertEquals(
+            set(self.get_manager().select_subclasses()),
+            set([self.child1, self.child2]))
 
 
-        def test_select_specific_subclasses(self):
-            self.assertEquals(
-                set(self.get_manager().select_subclasses(
-                        "inheritancemanagertestchild1")),
-                set([self.child1,
-                     InheritanceManagerTestParent(pk=self.child2.pk)]))
+    def test_select_specific_subclasses(self):
+        self.assertEquals(
+            set(self.get_manager().select_subclasses(
+                    "inheritancemanagertestchild1")),
+            set([self.child1,
+                 InheritanceManagerTestParent(pk=self.child2.pk)]))
 
-        def test_get_subclass(self):
-            self.assertEquals(
-                self.get_manager().get_subclass(pk=self.child1.pk),
-                self.child1)
+    def test_get_subclass(self):
+        self.assertEquals(
+            self.get_manager().get_subclass(pk=self.child1.pk),
+            self.child1)
 
 
-    class InheritanceManagerRelatedTests(InheritanceManagerTests):
-        def setUp(self):
-            self.related = InheritanceManagerTestRelated.objects.create()
-            self.child1 = InheritanceManagerTestChild1.objects.create(
-                related=self.related)
-            self.child2 = InheritanceManagerTestChild2.objects.create(
-                related=self.related)
+class InheritanceManagerRelatedTests(InheritanceManagerTests):
+    def setUp(self):
+        self.related = InheritanceManagerTestRelated.objects.create()
+        self.child1 = InheritanceManagerTestChild1.objects.create(
+            related=self.related)
+        self.child2 = InheritanceManagerTestChild2.objects.create(
+            related=self.related)
 
 
-        def get_manager(self):
-            return self.related.imtests
+    def get_manager(self):
+        return self.related.imtests
 
 
     def test_get_method_with_select_subclasses(self):
-        self.assertEqual(InheritanceManagerTestParent.objects.select_subclasses().get(id=self.child1.id),
-                         self.child1)
-        
-        
+        self.assertEqual(
+            InheritanceManagerTestParent.objects.select_subclasses().get(
+                id=self.child1.id),
+            self.child1)
+
+
 class TimeStampedModelTests(TestCase):
     def test_created(self):
         t1 = TimeStamp.objects.create()
 
 
 
-# @@@ Use proper test skipping once Django 1.2 is minimum supported version.
 try:
     from south.modelsinspector import introspector
 except ImportError:
     introspector = None
 
-if introspector is not None:
+# @@@ use skipUnless once Django 1.3 is minimum supported version
+if introspector:
     class SouthFreezingTests(TestCase):
         def test_introspector_adds_no_excerpt_field(self):
             mf = Article._meta.get_field('body')
         self.assertRaises(pickle.PicklingError, dump_load)
 
 
-    # @@@ Use proper test skipping once Django 1.2 is minimum supported version.
-    if sys.version_info >= (2, 6):
-        # @@@ catch_warnings only available in Python 2.6 and newer
-        def test_pending_deprecation(self):
-            with warnings.catch_warnings(record=True) as w:
-                warnings.simplefilter("always")
-                manager_from()
-                self.assertEqual(len(w), 1)
-                assert issubclass(w[-1].category, PendingDeprecationWarning)
+    def test_pending_deprecation(self):
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            manager_from()
+            self.assertEqual(len(w), 1)
+            assert issubclass(w[-1].category, PendingDeprecationWarning)
 
 
 
 [tox]
-envlist=py25-1.1,py25-1.2,py25,py25-trunk,py26-1.1,py26-1.2,py26,py26-trunk,py27-1.1,py27-1.2,py27,py27-trunk
+envlist=py26-1.2,py26,py26-trunk,py27-1.2,py27,py27-trunk
 
 [testenv]
 deps=
-  django==1.3
+  django==1.3.1
   South==0.7.3
 commands=python setup.py test
 
-[testenv:py25-1.1]
-basepython=python2.5
-deps=
-  django==1.1.4
-  South==0.7.3
-
-[testenv:py25-1.2]
-basepython=python2.5
-deps=
-  django==1.2.5
-  South==0.7.3
-
-[testenv:py25-trunk]
-basepython=python2.5
-deps=
-  svn+http://code.djangoproject.com/svn/django/trunk#egg=django
-  South==0.7.3
-
-[testenv:py26-1.1]
-basepython=python2.6
-deps=
-  django==1.1.4
-  South==0.7.3
-
 [testenv:py26-1.2]
 basepython=python2.6
 deps=
-  django==1.2.5
+  django==1.2.7
   South==0.7.3
 
 [testenv:py26-trunk]
 basepython=python2.6
 deps=
-  svn+http://code.djangoproject.com/svn/django/trunk#egg=django
-  South==0.7.3
-
-[testenv:py27-1.1]
-basepython=python2.7
-deps=
-  django==1.1.4
+  https://github.com/django/django/tarball/master
   South==0.7.3
 
 [testenv:py27-1.2]
 basepython=python2.7
 deps=
-  django==1.2.5
+  django==1.2.7
   South==0.7.3
 
 [testenv:py27-trunk]
 basepython=python2.7
 deps=
-  svn+http://code.djangoproject.com/svn/django/trunk#egg=django
+  https://github.com/django/django/tarball/master
   South==0.7.3