Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed errors introduced in r14279 when running Django tests under Pyt…

…hon < 2.6.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14287 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cfbba28c39e2063dbad0362c35ece2a97a9353f2 1 parent c0cb75c
Ramiro Morales authored October 19, 2010

Showing 1 changed file with 12 additions and 3 deletions. Show diff stats Hide diff stats

  1. 15  tests/regressiontests/queries/tests.py
15  tests/regressiontests/queries/tests.py
@@ -1435,7 +1435,8 @@ def test_evaluated_queryset_as_argument(self):
1435 1435
 
1436 1436
 class EmptyQuerySetTests(TestCase):
1437 1437
     def test_emptyqueryset_values(self):
1438  
-        "#14366 -- calling .values() on an EmptyQuerySet and then cloning that should not cause an error"
  1438
+        # #14366 -- Calling .values() on an EmptyQuerySet and then cloning that
  1439
+        # should not cause an error"
1439 1440
         self.assertEqual(list(Number.objects.none().values('num').order_by('num')), [])
1440 1441
 
1441 1442
     def test_values_subquery(self):
@@ -1486,10 +1487,18 @@ def test_ticket_7302(self):
1486 1487
         )
1487 1488
 
1488 1489
 
1489  
-class ConditionalTests(TestCase):
  1490
+class ConditionalTests(BaseQuerysetTest):
1490 1491
     """Tests whose execution depend on dfferent environment conditions like
1491 1492
     Python version or DB backend features"""
1492 1493
 
  1494
+    def setUp(self):
  1495
+        generic = NamedCategory.objects.create(name="Generic")
  1496
+        t1 = Tag.objects.create(name='t1', category=generic)
  1497
+        t2 = Tag.objects.create(name='t2', parent=t1, category=generic)
  1498
+        t3 = Tag.objects.create(name='t3', parent=t1)
  1499
+        t4 = Tag.objects.create(name='t4', parent=t3)
  1500
+        t5 = Tag.objects.create(name='t5', parent=t3)
  1501
+
1493 1502
     # In Python 2.6 beta releases, exceptions raised in __len__ are swallowed
1494 1503
     # (Python issue 1242657), so these cases return an empty list, rather than
1495 1504
     # raising an exception. Not a lot we can do about that, unfortunately, due to
@@ -1499,7 +1508,7 @@ class ConditionalTests(TestCase):
1499 1508
     def test_infinite_loop(self):
1500 1509
         # If you're not careful, it's possible to introduce infinite loops via
1501 1510
         # default ordering on foreign keys in a cycle. We detect that.
1502  
-        self.assertRaises(
  1511
+        self.assertRaisesMessage(
1503 1512
             FieldError,
1504 1513
             'Infinite loop caused by ordering.',
1505 1514
             LoopX.objects.all

0 notes on commit cfbba28

Please sign in to comment.
Something went wrong with that request. Please try again.