Fixed isolation of GenericRelationTests.test_filter_targets_related_pk().
@@ -228,9 +228,11 @@ class GenericRelationTests(TestCase):
self.assertEqual(qs.filter(links__sum__isnull=False).count(), 0)
def test_filter_targets_related_pk(self):
- HasLinkThing.objects.create()
- hs2 = HasLinkThing.objects.create()
- link = Link.objects.create(content_object=hs2)
+ # Use hardcoded PKs to ensure different PKs for "link" and "hs2"
+ # objects.
+ HasLinkThing.objects.create(pk=1)
+ hs2 = HasLinkThing.objects.create(pk=2)
+ link = Link.objects.create(content_object=hs2, pk=1)
self.assertNotEqual(link.object_id, link.pk)
self.assertSequenceEqual(HasLinkThing.objects.filter(links=link.pk), [hs2])
