executablebooks / mdit-py-plugins

Collection of core plugins for markdown-it-py
https://mdit-py-plugins.readthedocs.io
MIT License
30 stars 32 forks source link

Fix the required version for markdow-it-py #92

Closed eamanu closed 2 months ago

eamanu commented 1 year ago

Describe the bug

During the packaging of the last version of mdit-py-plugins in Debian, some tests failed:

=========================== short test summary info ============================
FAILED tests/test_admon.py::test_all[306-Indented by 4 spaces, DISABLE-CODEBLOCKS-    ??? note\n        content\n-<div class="admonition note is-collapsible collapsible-closed">\n<p class="admonition-title">Note</p>\n<p>content</p>\n</div>\n]
FAILED tests/test_amsmath.py::test_fixtures[237-Indented by 4 spaces, DISABLE-CODEBLOCKS-    \\begin{equation}\n    a = 1\n    \\end{equation}\n-<div class="math amsmath">\n\\begin{equation}\n    a = 1\n    \\end{equation}\n</div>\n]
FAILED tests/test_attrs.py::test_attrs[254-Indented by 4 spaces, DISABLE-CODEBLOCKS-    {#a .a b=c}\n    # head\n-<h1 id="a" b="c" class="a">head</h1>\n]
FAILED tests/test_colon_fence.py::test_fixtures[438-Indented by 4 spaces, DISABLE-CODEBLOCKS-    :::name\n    foo\n    :::\n-<pre><code class="block-name" >foo\n</code></pre>\n]
FAILED tests/test_container.py::test_all[301-Indented by 4 spaces, DISABLE-CODEBLOCKS-    ::: name\n    content\n    :::\n-<div class="name">\n<p>content</p>\n</div>\n]
FAILED tests/test_deflist.py::test_all[261-Indented by 4 spaces, DISABLE-CODEBLOCKS-    Term 1\n\n    : Definition 1\n-<dl>\n<dt>Term 1</dt>\n<dd>Definition 1</dd>\n</dl>\n]
FAILED tests/test_dollarmath.py::test_dollarmath_fixtures[575-Indented by 4 spaces, DISABLE-CODEBLOCKS-    $$a$$\n-<div class="math block">\na\n</div>\n]
FAILED tests/test_field_list.py::test_all[378-Indented_by_4_spaces,_DISABLE-CODEBLOCKS]
FAILED tests/test_footnote.py::test_all[360-Indented by 4 spaces, DISABLE-CODEBLOCKS-    [^1]\n\n    [^1]: footnote\n-<p><sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup></p>\n<hr class="footnotes-sep">\n<section class="footnotes">\n<ol class="footnotes-list">\n<li id="fn1" class="footnote-item"><p>footnote <a href="#fnref1" class="footnote-backref">\u21a9\ufe0e</a></p>\n</li>\n</ol>\n</section>\n]
FAILED tests/test_myst_block.py::test_all[168-Indented by 4 spaces, DISABLE-CODEBLOCKS-    +++\n\n    % abc\n\n    (a)=\n-<hr class="myst-block">\n<!-- abc --><div class="myst-target"><a href="#a">(a)=</a></div>\n]
======================== 10 failed, 400 passed in 0.45s ========================

All of those failed with the form:

    @pytest.mark.parametrize("line,title,input,expected", read_fixture_file(FIXTURE_PATH))
    def test_all(line, title, input, expected):
        md = MarkdownIt("commonmark").use(myst_block_plugin)
        if "DISABLE-CODEBLOCKS" in title:
            md.disable("code")
        md.options["xhtmlOut"] = False
        text = md.render(input)
        print(text)
>       assert text.rstrip() == expected.rstrip()
E       assert '<p>+++</p>\n...\n<p>(a)=</p>' == '<hr class="m...a)=</a></div>'
E         - <hr class="myst-block">
E         - <!-- abc --><div class="myst-target"><a href="#a">(a)=</a></div>
E         + <p>+++</p>
E         + <p>% abc</p>
E         + <p>(a)=</p>

I figured out that updating the version of markdown-it-py package fix the error.

Looking #89, that use markdow-it-py 2.2.0, and I used version 2.1.0, seems that the dependencies variable in pyproject.toml can be change to avoid confusion:

dependencies = ["markdown-it-py>=3.0.0,<4.0.0"]

Reproduce the bug

Run tests with versions of markdown-it-py minor than 3.0.0

List your environment

No response

chrisjsewell commented 2 months ago

I'm afraid the tests are not intended for end users, there is no guarantee they work outside of this repository and its CLI/dev setup