Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #18949 -- Fix broken test interactions in ModelForms tests

A test in Model Forms test was specifically referring to a fixed
primary key, which was now being used up in a newly committed.
This has been worked around by specifying a higher primary
key.
  • Loading branch information...
commit fdea2621cd3f3de472afaab7aa7152a1dc4f505c 1 parent 79a484f
Anton Ian Sipos authored ptone committed

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  tests/modeltests/model_forms/tests.py
5  tests/modeltests/model_forms/tests.py
@@ -1060,7 +1060,10 @@ def test_with_data(self):
1060 1060
         # Add a Category object *after* the ModelMultipleChoiceField has already been
1061 1061
         # instantiated. This proves clean() checks the database during clean() rather
1062 1062
         # than caching it at time of instantiation.
1063  
-        c6 = Category.objects.create(id=6, name='Sixth', url='6th')
  1063
+        # Note, we are using an id of 1006 here since tests that run before
  1064
+        # this may create categories with primary keys up to 6. Use
  1065
+        # a number that is will not conflict.
  1066
+        c6 = Category.objects.create(id=1006, name='Sixth', url='6th')
1064 1067
         self.assertEqual(c6.name, 'Sixth')
1065 1068
         self.assertQuerysetEqual(f.clean([c6.id]), ["Sixth"])
1066 1069
 

0 notes on commit fdea262

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