Commits

Waldemar Kornewald committed 0b27295

switched to unittest2 library's skipIf (now part of Django 1.3)

  • Participants
  • Parent commits 0ec7bca

Comments (0)

Files changed (2)

djangotoolbox/test.py

 except ImportError:
     from cStringIO import StringIO
 
-def skip_if(test):
-    """Skips a unit test if ``test`` is ``True``"""
-    def _inner(func):
-        if test:
-            return None
-        return func
-    return _inner
-
 class ModelTestCase(TestCase):
     """
     A test case for models that provides an easy way to validate the DB

djangotoolbox/tests.py

 from .fields import ListField, SetField, DictField
-from .test import skip_if
 from django.db import models, connections
 from django.db.models import Q
+from django.db.utils import DatabaseError
 from django.test import TestCase
-from django.db.utils import DatabaseError
+from django.utils import unittest
 
 class ListModel(models.Model):
     floating_point = models.FloatField()
         # an empty list
         SetModel().save()
 
-    @skip_if(not supports_dicts)
+    @unittest.skipIf(not supports_dicts, "Backend doesn't support dicts")
     def test_dictfield(self):
         DictModel(dictfield=dict(a=1, b='55', foo=3.14)).save()
         item = DictModel.objects.get()
         # an empty dict
         DictModel().save()
 
-    # passes on GAE production but not on sdk
-    @skip_if(True)
+    @unittest.skip('Fails with GAE SDK, but passes on production')
     def test_Q_objects(self):
         self.assertEquals([entity.names for entity in
             ListModel.objects.exclude(Q(names__lt='Sakura') | Q(names__gte='Sasuke'))],
-                [['Kakashi', 'Naruto', 'Sasuke', 'Sakura'], ])
+                [['Kakashi', 'Naruto', 'Sasuke', 'Sakura']])
 
 class BaseModel(models.Model):
     pass