hoedown/hoedown

Fail to run tests with Python 3.5 due to deprecated HTMLParseError

Opened this issue · 1 comments

Running make test on up-to-date Debian Stretch results in:

make test
[ 78%] Built target libhoedown
[100%] Built target hoedown
Traceback (most recent call last):
  File "CommonMark/test/spec_tests.py", line 9, in <module>
    from normalize import normalize_html
  File "/home/ghislain/local/src/hoedown/CommonMark/test/normalize.py", line 2, in <module>
    from html.parser import HTMLParser, HTMLParseError
ImportError: cannot import name 'HTMLParseError'
CMakeFiles/test.dir/build.make:57: recipe for target 'CMakeFiles/test' failed
make[3]: *** [CMakeFiles/test] Error 1
CMakeFiles/Makefile2:237: recipe for target 'CMakeFiles/test.dir/all' failed
make[2]: *** [CMakeFiles/test.dir/all] Error 2
CMakeFiles/Makefile2:244: recipe for target 'CMakeFiles/test.dir/rule' failed
make[1]: *** [CMakeFiles/test.dir/rule] Error 2
Makefile:227: recipe for target 'test' failed
make: *** [test] Error 2

HTMLParseError was replaced by regular Exception starting from Python 3.5. A simple fix could be to use:

try:
    html.parser import HTMLParseError
except ImportError:
    class HTMLParseError(Exception):
        pass

The real problem here is that the CommonMark mirror in the dev branch is way too out-of-date. The upstream already fixed this in master.