Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#21307 closed Bug (fixed)

humanize tests depend on a test case mixin defined on tests/i18n/

Reported by: ramiro Owned by: anonymous
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by ramiro)

As reported in django-users (

  1. Having 'django.contrib.humanize' listed in INSTALLED_APPS
  2. Using TEST_RUNNER='django.test.simple.DjangoTestSuiteRunner'
  3. Trying to run the tests using test

Reported against 1.6b4 but an be reproduced with current 1.6.x and master.

Result of discussion on IRC resulted a suggested fix: Move the TransRealMixin added in 9a1ea4e7e8214a001ca43ae6f0fcea96a5d51489 to a place under the django hierarchy, i.e. django.test.utils that would allow it to be imported using an absolute import.

Change History (6)

comment:1 Changed 2 years ago by ramiro

  • Description modified (diff)

comment:2 Changed 2 years ago by ramiro

  • Has patch set
  • Triage Stage changed from Unreviewed to Accepted

This is the actual error output:

$ ./ test
django/test/ DeprecationWarning: The django.test._doctest module is deprecated; use the doctest module from the Python standard library instead.   DeprecationWarning)

django/test/ DeprecationWarning: The django.test.simple module and DjangoTestSuiteRunner are deprecated; use django.test.runner.DiscoverRunner instead.   DeprecationWarning)

Traceback (most recent call last):
  File "./", line 10, in <module>
  File "django/core/management/", line 408, in execute_from_command_line
  File "django/core/management/", line 401, in execute
  File "django/core/management/commands/", line 50, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "django/core/management/", line 244, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "django/core/management/commands/", line 71, in execute
    super(Command, self).execute(*args, **options)
  File "django/core/management/", line 291, in execute
    output = self.handle(*args, **options)
  File "django/core/management/commands/", line 88, in handle
    failures = test_runner.run_tests(test_labels)
  File "django/test/", line 145, in run_tests
    suite = self.build_suite(test_labels, extra_tests)
  File "django/test/", line 249, in build_suite
  File "django/test/", line 151, in build_suite
    test_module = get_tests(app_module)
  File "django/test/", line 103, in get_tests
    test_module = import_module('.'.join(prefix + [TEST_MODULE]))
  File "/usr/lib/python2.7/importlib/", line 37, in import_module
  File "django/contrib/humanize/", line 21, in <module>
    from i18n import TransRealMixin
ImportError: No module named i18n

I've opened a PR with a propsed fix:

comment:3 Changed 2 years ago by anonymous

  • Owner changed from nobody to anonymous
  • Status changed from new to assigned

comment:4 Changed 2 years ago by timo

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 2 years ago by Ramiro Morales <cramm0@…>

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

In 51d2e1fb233b5507bf14300787939717c4d93834:

Fixed #21307 -- Moved TransRealMixin to django.test.utils.

comment:6 Changed 2 years ago by Ramiro Morales <cramm0@…>

In bcc65c13a086f3e6d24dc7fc92a167fd836af501:

[1.6.x] Fixed #21307 -- Moved TransRealMixin to django.test.utils.

51d2e1fb23 from master.

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