#20502 closed Bug (fixed)

AppResolutionOrderI18NTests fails if 'de' locale cached by previous test

Reported by: gcc Owned by: claudep
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

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 Changed 22 months ago by gcc

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to gcc
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 22 months ago by bmispelon

  • Cc bmispelon@… added
  • Triage Stage changed from Unreviewed to Accepted

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 Changed 22 months ago by claudep

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

comment:4 Changed 22 months ago by claudep

  • Component changed from Uncategorized to Testing framework
  • Patch needs improvement set
  • Type changed from Uncategorized to Bug

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

comment:5 Changed 21 months ago by timo

@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 21 months ago by claudep

  • Owner changed from gcc to claudep

Yes, I will push a solution based on TransRealMixin.

comment:7 Changed 21 months ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 9d06c6ccc92e240af245205316cf6075b37a24e3:

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

Thanks Chris Wilson for the report and initial patch.

comment:8 Changed 21 months ago by timo

  • Cc timograham@… added
  • Has patch unset
  • Patch needs improvement unset
  • Resolution fixed deleted
  • Status changed from closed to new

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 21 months ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

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