Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[1.5.x] 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
  • Loading branch information...
1 parent dbe984c commit 81342c28c6e4fbf98296555691750c33bce1bbc7 @aisipos aisipos committed with ptone
Showing with 4 additions and 1 deletion.
  1. +4 −1 tests/modeltests/model_forms/
5 tests/modeltests/model_forms/
@@ -1060,7 +1060,10 @@ def test_with_data(self):
# Add a Category object *after* the ModelMultipleChoiceField has already been
# instantiated. This proves clean() checks the database during clean() rather
# than caching it at time of instantiation.
- c6 = Category.objects.create(id=6, name='Sixth', url='6th')
+ # Note, we are using an id of 1006 here since tests that run before
+ # this may create categories with primary keys up to 6. Use
+ # a number that is will not conflict.
+ c6 = Category.objects.create(id=1006, name='Sixth', url='6th')
self.assertEqual(, 'Sixth')
self.assertQuerysetEqual(f.clean([]), ["Sixth"])

0 comments on commit 81342c2

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