Jc2k / pytest-markdown

Run tests in your markdown
11 stars 2 forks source link

Plugin crashes because of commonmark #5

Closed kpj closed 3 years ago

kpj commented 3 years ago

I have installed pytest-markdown v1.0.0 (__version__ is still 0.0.7 unfortunately) and pytest v6.2.1 with Python 3.9.0.

When running pytest, I get the following error:

[..]
  File "/site-packages/_pytest/assertion/rewrite.py", line 170, in exec_module
    exec(co, module.__dict__)
  File "/site-packages/pytest_markdown/plugin.py", line 7, in <module>
    import commonmark
  File "/site-packages/commonmark/__init__.py", line 4, in <module>
    from commonmark.main import commonmark
  File "/site-packages/commonmark/main.py", line 14, in <module>
    from commonmark.blocks import Parser
  File "/site-packages/commonmark/blocks.py", line 5, in <module>
    from commonmark import common
  File "/site-packages/commonmark/common.py", line 14, in <module>
    HTMLunescape = html.parser.HTMLParser().unescape
AttributeError: 'HTMLParser' object has no attribute 'unescape'

Apparently, HTMLParser.unescape was removed from Python 3.9. Updating commonmark might be enough to resolve this issue.

Jc2k commented 3 years ago

Thanks for the bug report. Our upstream dependency commonmark is quiet about python 3.8 support, much less 3.9 support. It does look like they fixed it in 0.9.x, though, so i've updated CI to test against py 3.9, updated our dependencies to pull in the right version and updated our pyproject.toml to declare the next release can be used with python 3.9. If everything goes green i'll do a release.

Jc2k commented 3 years ago

Fix is out.

kpj commented 3 years ago

Great, thanks a lot!