Opened 11 years ago

Closed 11 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: dev
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

Description

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 by Chris Wilson, 11 years ago

Owner: changed from nobody to Chris Wilson
Status: newassigned

comment:2 by Baptiste Mispelon, 11 years ago

Cc: bmispelon@… added
Triage Stage: UnreviewedAccepted

Thanks!

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:

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

comment:3 by Claude Paroz, 11 years ago

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

comment:4 by Claude Paroz, 11 years ago

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

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

comment:5 by Tim Graham, 11 years ago

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

comment:6 by Claude Paroz, 11 years ago

Owner: changed from Chris Wilson to Claude Paroz

Yes, I will push a solution based on TransRealMixin.

comment:7 by Claude Paroz <claude@…>, 11 years ago

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 by Tim Graham, 11 years ago

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 by Claude Paroz <claude@…>, 11 years ago

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