Changes between Initial Version and Version 1 of Ticket #27937


Ignore:
Timestamp:
Mar 14, 2017, 7:19:00 AM (8 years ago)
Author:
Luke Benstead
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27937 – Description

    initial v1  
    77Here's one of those tests:
    88
     9{{{
    910    def test_limit_choices_to_callable_for_fk_rel(self):
    1011        """
     
    1314        stumpjokeform = StumpJokeForm()
    1415        self.assertSequenceEqual(stumpjokeform.fields['most_recently_fooled'].queryset, [self.threepwood])
     16}}}
    1517
    1618The reason for the failure, is that immediately after `StumpJokeForm()` is instantiated (by the second of the two tests) the field's `queryset._result_cache` is already populated, holding an instance which no longer exists in the database as it was flushed between tests. It's as if the field's queryset is persisting between form instantiations, and between tests. It looks likely that this wouldn't show up in a normal Django test run because IDs are sequential there and so the IDs match when testing the assertion.
Back to Top