﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27951	Nondeterministic ordering test failure in model_forms on Oracle	Shai Berger	nobody	"This from our CI:
{{{
======================================================================
FAIL [0.018s]: test_to_field_name_with_initial_data (model_forms.tests.ModelMultipleChoiceFieldTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""<https://djangoci.com/job/django-oracle-1.11/database=oracle12,label=trusty,python=python2.7/ws/tests/model_forms/tests.py"",> line 1974, in test_to_field_name_with_initial_data
    self.assertEqual(form['categories'].value(), [self.c2.slug, self.c3.slug])
AssertionError: Lists differ: [u'third-test', u'its-test'] != [u'its-test', u'third-test']

First differing element 0:
u'third-test'
u'its-test'

- [u'third-test', u'its-test']
+ [u'its-test', u'third-test']

----------------------------------------------------------------------
}}}

The relevant code in {{{stable/1.11.x}}} is:
{{{
    def test_to_field_name_with_initial_data(self):
        class ArticleCategoriesForm(forms.ModelForm):
            categories = forms.ModelMultipleChoiceField(Category.objects.all(), to_field_name='slug')

            class Meta:
                model = Article
                fields = ['categories']

        article = Article.objects.create(
            headline='Test article',
            slug='test-article',
            pub_date=datetime.date(1988, 1, 4),
            writer=Writer.objects.create(name='Test writer'),
            article='Hello.',
        )
        article.categories.add(self.c2, self.c3)
        form = ArticleCategoriesForm(instance=article)
        self.assertEqual(form['categories'].value(), [self.c2.slug, self.c3.slug])
}}}

In master it's the same except that the {{{assertEqual}}} in the end is replaced with {{{assertCountEqual}}} which ignore the order of items. I propose that we backport this change (ticket opened really mostly because we're in code freeze)."	Bug	closed	Forms	1.11	Release blocker	fixed	test		Unreviewed	0	0	0	0	0	0
