regressiontests.test_utils.tests.HTMLEqualTests.test_parsing_errors() fails with Python >=2.7.3, which contains improved HTMLParser.HTMLParser.
$ PYTHONPATH="." python2.7 tests/runtests.py --settings=test_sqlite -v2 test_utils.HTMLEqualTests.test_parsing_errors
Importing application test_utils
Creating test database for alias 'default' (':memory:')...
Creating tables ...
Creating table django_content_type
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_site
Creating table django_flatpage_sites
Creating table django_flatpage
Creating table django_redirect
Creating table django_session
Creating table django_comments
Creating table django_comment_flags
Creating table django_admin_log
Creating table test_utils_person
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Creating test database for alias 'other' (':memory:')...
Creating tables ...
Creating table django_content_type
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_site
Creating table django_flatpage_sites
Creating table django_flatpage
Creating table django_redirect
Creating table django_session
Creating table django_comments
Creating table django_comment_flags
Creating table django_admin_log
Creating table test_utils_person
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
test_parsing_errors (regressiontests.test_utils.tests.HTMLEqualTests) ... FAIL
======================================================================
FAIL: test_parsing_errors (regressiontests.test_utils.tests.HTMLEqualTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/Django-1.4/tests/regressiontests/test_utils/tests.py", line 426, in test_parsing_errors
parse_html('<!--')
AssertionError: HTMLParseError not raised
----------------------------------------------------------------------
Ran 1 test in 0.002s
FAILED (failures=1)
Destroying test database for alias 'default' (':memory:')...
Destroying test database for alias 'other' (':memory:')...
$ python2.6 -c 'import HTMLParser; parser = HTMLParser.HTMLParser(); parser.feed("<!--"); parser.close(); print(parser)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib64/python2.6/HTMLParser.py", line 112, in close
self.goahead(1)
File "/usr/lib64/python2.6/HTMLParser.py", line 164, in goahead
self.error("EOF in middle of construct")
File "/usr/lib64/python2.6/HTMLParser.py", line 115, in error
raise HTMLParseError(message, self.getpos())
HTMLParser.HTMLParseError: EOF in middle of construct, at line 1, column 1
$ python2.7 -c 'import HTMLParser; parser = HTMLParser.HTMLParser(); parser.feed("<!--"); parser.close(); print(parser)'
<HTMLParser.HTMLParser instance at 0x7fe49def5878>
$ python2.7 -c 'import sys; print(sys.version_info)'
sys.version_info(major=2, minor=7, micro=3, releaselevel='candidate', serial=2)
I have been bitten by this as well here on Debian Unstable while trying to update the python-django package.