Tests don't run under Python 2.7 (unittest._WritelnDecorator has moved)

Bug #582113 reported by Andrew Bennetts
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Martin Packman

Bug Description

bzrlib/tests/__init__.py tries to access unittest._WritelnDecorator, but this doesn't exist in (unreleased) Python 2.7's unittest module.

The hackish fix is to try importing _WritelnDecorator from unittest.runner (where it can be found in 2.7). A better fix would be to stop relying on non-public attributes, perhaps by convincing Python to expose this useful class somewhere public? Or perhaps put this functionality into testtools?

Tags: python27

Related branches

Revision history for this message
Andrew Bennetts (spiv) wrote :

Also, we use unittest._TextTestResult, which is still provided but deprecated in 2.7. The preferred name in 2.7 is unittest.TextTestResult.

Revision history for this message
Martin Packman (gz) wrote :

Can address these particular incompatibilities by just not using _WritelnDecorator, and depending on the testtools TextTestResult rather than the unittest one.

There seem to be some deeper issues with the many unittest changes in Python 2.7 though, particularly from implementing a bunch of the same extensions bzrlib has but in a slightly different manner. Have added a known failure for bug 607400 and worked around bug 607412 for the moment.

Changed in bzr:
assignee: nobody → Martin [gz] (gz)
Martin Packman (gz)
tags: added: python2.7
Revision history for this message
Martin Packman (gz) wrote :

Committed on bzr.dev in r5372 as a side effect of dependent branch landing.

Changed in bzr:
status: Confirmed → Fix Released
Martin Packman (gz)
tags: added: python27
removed: python2.7
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.