Opened 13 years ago

Last modified 13 years ago

#17641 closed Bug

HTMLParser has no interesting_cdata attribute with a Python version > 2.7.1 — at Version 1

Reported by: Ramiro Morales Owned by: nobody
Component: Testing framework Version: dev
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

Our recent enhancements to the HTML content checking assertions in our test utils subclass and customizes standard library HTMLParser. But in recent HTMLParser shipped with recent 2.7.x CPythons there is no more a interesting_cdata module-level RE variable.

This results in 15 errors in our test suite like this

======================================================================
ERROR: test_readonly_get (regressiontests.admin_views.tests.ReadonlyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/regressiontests/admin_views/tests.py", line 2861, in test_readonly_get
    self.assertContains(response, '<p class="help">Some help text for the title (with unicode ŠĐĆŽćžšđ)</p>', html=True)
  File "django/test/testcases.py", line 627, in assertContains
    u"Response's content is not valid HTML:")
  File "django/test/testcases.py", line 87, in assert_and_parse_html
    dom = parse_html(html)
  File "django/test/html.py", line 213, in parse_html
    parser.feed(html)
  File "/usr/lib/python2.7/HTMLParser.py", line 111, in feed
    self.goahead(0)
  File "/usr/lib/python2.7/HTMLParser.py", line 155, in goahead
    k = self.parse_starttag(i)
  File "django/utils/htmlparser.py", line 68, in parse_starttag
    self.set_cdata_mode(tag) # <--------------------------- Changed
  File "django/utils/htmlparser.py", line 14, in set_cdata_mode
    self.interesting = _HTMLParser.interesting_cdata
AttributeError: 'module' object has no attribute 'interesting_cdata'

See:

Our CI server is using an older 2.7.x Python.

Change History (2)

comment:1 by Ramiro Morales, 13 years ago

Description: modified (diff)
Has patch: set

by Ramiro Morales, 13 years ago

Attachment: 17641-1.diff added
Note: See TracTickets for help on using tickets.
Back to Top