Opened 6 years ago

Closed 6 years ago

#20502 closed Bug (fixed)

AppResolutionOrderI18NTests fails if 'de' locale cached by previous test

Reported by: Chris Wilson Owned by: Claude Paroz
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: bmispelon@…, timograham@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Dicsovered by Travis running all Django tests:

If the following tests are run in this order:

  • defaultfilters.tests.DefaultFiltersTests.test_localized_filesizeformat
  • i18n.tests.AppResolutionOrderI18NTests

then the second test will fail because the first has cached the 'de' translation before the second one changes INSTALLED_APPS to install the test app, which has its own translation.

Change History (9)

comment:1 Changed 6 years ago by Chris Wilson

Owner: changed from nobody to Chris Wilson
Status: newassigned

comment:2 Changed 6 years ago by Baptiste Mispelon

Cc: bmispelon@… added
Triage Stage: UnreviewedAccepted


I hit this issue during the sprints but could I wasn't able to find the conflicting tests (bisect wasn't helpful).

Now I can reproduce this consistently:

./ --settings=test_sqlite defaultfilters.tests.DefaultFiltersTests.test_localized_filesizeformat i18n.tests.AppResolutionOrderI18NTests always fail while ./ --settings=test_sqlite i18n.tests.AppResolutionOrderI18NTests defaultfilters.tests.DefaultFiltersTests.test_localized_filesizeformat passes.

comment:3 Changed 6 years ago by Claude Paroz

I guess the solution would be to isolate that test in a class inheriting from the new tests.i18n.TransRealMixin.

comment:4 Changed 6 years ago by Claude Paroz

Component: UncategorizedTesting framework
Patch needs improvement: set
Type: UncategorizedBug

Oh, didn't saw at first there was a pull request.

comment:5 Changed 6 years ago by Tim Graham

@claudep, looks like the pull request solves the issue, but did you set "Patch needs improvement" because you want a different approach?

comment:6 Changed 6 years ago by Claude Paroz

Owner: changed from Chris Wilson to Claude Paroz

Yes, I will push a solution based on TransRealMixin.

comment:7 Changed 6 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: assignedclosed

In 9d06c6ccc92e240af245205316cf6075b37a24e3:

Fixed #20502 -- Flushed i18n caches for a defaultfilter test

Thanks Chris Wilson for the report and initial patch.

comment:8 Changed 6 years ago by Tim Graham

Cc: timograham@… added
Has patch: unset
Patch needs improvement: unset
Resolution: fixed
Status: closednew

Looks like this also affects:

  • tests.forms_tests.tests.test_regressions.FormsRegressionsTestCase.test_regression_3600
  • tests.template_tests.tests.Templates.test_templates (must run then entire template_tests package to avoid missing template failures)
  • django.contrib.humanize.tests.HumanizeTests.test_i18n_intcomma and test_i18n_intword

Run any of these tests followed by i18n.tests.AppResolutionOrderI18NTests to see the failure.

comment:9 Changed 6 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In b67f2ac8e6f8cdef237590ffb2c85fc30454ba75:

Fixed #20502 (again) -- More i18n cache flush in tests

Thanks Timo Graham for noticing the failures.

Note: See TracTickets for help on using tickets.
Back to Top