Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24903 closed Bug (fixed)

Backport assertRaisesMessage fix

Reported by: Moritz Sichert Owned by: Tim Graham
Component: Testing framework Version: 1.8
Severity: Normal Keywords: test assert raises message
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Moritz Sichert)

In https://bugs.python.org/issue24134 cpython changed the behaviour of assertRaises that breaks django's assertRaisesMessage.
Unfortunately this bug is not fixed in cpython's 2.7.10 release, so I think the fixes on django's side should be backported at least to 1.8 because right now it's not possible to use assertRaisesMessage as context manager with 2.7.10.

Following commits contain the fixes on django's side:
c2bc1cefdcbbf074408f4a4cace88b315cf9d652
a0175724b086127a4e13612042961d3ba88d6bd9
e89c3a46035e9fe17c373a6c9cd63b9fd631d596

Change History (10)

comment:1 by Moritz Sichert, 9 years ago

Description: modified (diff)

comment:2 by Tim Graham, 9 years ago

I'm fairly sure that change was reverted in 2.7.10. Are you sure you're running the final version and not the release candidate? Django's test suite passes for me on 2.7.10.

comment:3 by Moritz Sichert, 9 years ago

$ wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
$ tar -xf Python-2.7.10.tar.xz
$ grep -n 'is _sentinel' Python-2.7.10/Lib/unittest/case.py
472:        if callableObj is _sentinel:
992:        if callable_obj is _sentinel:

I took it straight from the official download, so I think that's the final version.

The changes got reverted here:
https://hg.python.org/cpython/rev/0c93868f202e
Unfortunately that got merged into the 2.7 branch just after the 2.7.10 release.

comment:4 by Tim Graham, 9 years ago

Owner: changed from nobody to Tim Graham
Status: newassigned
Triage Stage: UnreviewedAccepted

Okay, that's a bit odd. The Windows installer seems to contain the revert but the gzip tarball doesn't. I'll try to figure out what's going on.

comment:5 by Tim Graham, 9 years ago

Has patch: set

From bitdancer in #python-dev regarding merging of fixes to the release branches of Python:

the way it is supposed to work is that issue like that get marked as "release blocker" in the tracker, and the release manager makes sure they are dealt with before cutting the release. Things do slip through the cracks, though, and once they do the need to go into NEWS.

And as to why the Windows version contains the fix:

things being different between different builds of the release is a bug in the release process. I'm not sure what happened there.

I'll fix this on 1.8 and 1.7. 1.4 isn't affected. PR

comment:6 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 8bc18eb:

[1.8.x] Fixed #24903 -- Fixed assertRaisesMessage on Python 2.7.10.

A regression in Python 2.7.10 rc1 wasn't reverted in the final
release: https://bugs.python.org/issue24134

Backport of two commits from master:

comment:7 by Tim Graham <timograham@…>, 9 years ago

In 207da07:

[1.7.x] Fixed #24903 -- Fixed assertRaisesMessage on Python 2.7.10.

A regression found in in Python 2.7.10 rc1 wasn't reverted for the final
release: https://bugs.python.org/issue24134

Backport of two commits from master:

comment:8 by Tim Graham <timograham@…>, 9 years ago

In 90c59db:

Forwardported release notes for refs #24903.

comment:9 by Bouke Haarsma, 9 years ago

I ran into this issue with Django 1.4 on Python 2.7.10 as well. Any chance on merging it into Django 1.4?

comment:10 by Tim Graham, 9 years ago

As Django 1.4 will be unsupported in a month and half (October 1), I don't think it's a priority.

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