tomchristie/django-pdb — Issue #4: manage.py test broken on Python 2.6
Author: ukch
Created: 2011-11-17 12:02:33+00:00
State: open

Steps to reproduce:

* Enable django-pdb in a project
* Run manage.py test

The following traceback is generated:

Traceback (most recent call last):
File "./manage.py", line 14, in
execute_manager(settings)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django_pdb-0.1.2-py2.6.egg/django_pdb/management/commands/test.py", line 2, in
from django_pdb.testrunners import PdbTestSuiteRunner
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django_pdb-0.1.2-py2.6.egg/django_pdb/testrunners.py", line 70, in
class PdbTestResult(ExceptionTestResultMixin, unittest._TextTestResult):
AttributeError: 'module' object has no attribute '_TextTestResult'

This can be fixed in one of two ways:

* Doing `from django.utils import unittest` instead of `import unittest`, and depending on Django >= 1.3.
* Doing `if sys.version_info[:2] < (2, 7): import unittest2 as unittest` and depending on unittest2 if Python version is less than 2.7.