Opened 5 years ago

Closed 5 years ago

#24827 closed Uncategorized (fixed)

assertRaisesMessage() fails with Python 2.7.10~rc1

Reported by: Raphaël Hertzog Owned by: nobody
Component: Testing framework Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently Debian Unstable has Python 2.7.10~rc1 and the Django test suite is falling apart since all calls to assertRaisesMessage() fail. All those errrors are gone when I run the test in Debian 8 Jessie with Python 2.7.9.

I'm not sure if it's a Python bug or a Django bug.

Here are two examples of failures in the test suite:

======================================================================
ERROR: test_avoid_infinite_loop_on_too_many_subqueries (queries.tests.Queries1Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/«PKGBUILDDIR»/tests/queries/tests.py", line 393, in test_avoid_infinite_loop_on_too_many_subquer
ies
    with self.assertRaisesMessage(RuntimeError, msg):
  File "/«PKGBUILDDIR»/django/test/testcases.py", line 582, in assertRaisesMessage
    re.escape(expected_message), callable_obj, *args, **kwargs)
  File "/«PKGBUILDDIR»/django/utils/six.py", line 643, in assertRaisesRegex
    return getattr(self, _assertRaisesRegex)(*args, **kwargs)
  File "/usr/lib/python2.7/unittest/case.py", line 995, in assertRaisesRegexp
    callable_obj(*args, **kwargs)
TypeError: 'NoneType' object is not callable

======================================================================
FAIL: test_recipients_as_string (mail.tests.MailTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/«PKGBUILDDIR»/tests/mail/tests.py", line 115, in test_recipients_as_string
    with self.assertRaisesMessage(TypeError, '"to" argument must be a list or tuple'):
  File "/«PKGBUILDDIR»/django/test/testcases.py", line 582, in assertRaisesMessage
    re.escape(expected_message), callable_obj, *args, **kwargs)
  File "/«PKGBUILDDIR»/django/utils/six.py", line 643, in assertRaisesRegex
    return getattr(self, _assertRaisesRegex)(*args, **kwargs)
AssertionError: "\"to\"\ argument\ must\ be\ a\ list\ or\ tuple" does not match "'NoneType' object is not callable"

Change History (1)

comment:1 Changed 5 years ago by Claude Paroz

Resolution: fixed
Status: newclosed

Thanks for the report, but I think this has been reverted in Python: https://bugs.python.org/issue24134

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