pypa / readme_renderer

Safely render long_description/README files in Warehouse
Apache License 2.0
158 stars 88 forks source link

Two test failures with pyments 2.14.0 #274

Closed mweinelt closed 1 year ago

mweinelt commented 1 year ago

The following tests are failing for us (nixpkgs), after upgrading to pygments 2.14.0 or, less likely bleach 6.0.

___________________ test_md_fixtures[test_CommonMark_008.md] ___________________
md_filename = PosixPath('/build/readme_renderer-37.3/tests/fixtures/test_CommonMark_008.md')
html_filename = PosixPath('/build/readme_renderer-37.3/tests/fixtures/test_CommonMark_008.html')
variant = 'CommonMark'
    @pytest.mark.parametrize(
        ("md_filename", "html_filename", "variant"),
        [
            (pytest.param(fn, fn.with_suffix(".html"), variant, id=fn.name))
            for variant in variants
            for fn in Path(__file__).parent.glob(f"fixtures/test_{variant}*.md")
        ],
    )
    def test_md_fixtures(md_filename, html_filename, variant):
        # Get our Markup
        with open(md_filename, encoding='utf-8') as f:
            md_markup = f.read()
        # Get our expected
        with open(html_filename, encoding="utf-8") as f:
            expected = f.read()
>       assert render(md_markup, variant=variant) == expected
E       assert '<p>Here is s...key</a></p>\n' == '<p>Here is s...key</a></p>\n'
E         Skipping 1054 identical leading characters in diff, use -v to show
E         - >if</span> <span class="o">[</span> <span class="s2">&quot;</span><span class="nv">$1</span><span class="s2">&quot;</span> <span class="o">=</span> <span class="s2">&quot;--help&quot;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
E         -     <span class="nb">echo</span> <span class="s2">&quot;OK&quot;</span>
E         + >if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$1</span><span class="s2">&quot;</spa...
E
E         ...Full output truncated (5 lines hidden), use '-vv' to show
tests/test_markdown.py:25: AssertionError
_____________________ test_rst_fixtures[test_rst_008.rst] ______________________
rst_filename = PosixPath('/build/readme_renderer-37.3/tests/fixtures/test_rst_008.rst')
html_filename = PosixPath('/build/readme_renderer-37.3/tests/fixtures/test_rst_008.html')
    @pytest.mark.parametrize(
        ("rst_filename", "html_filename"),
        [
            (pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
            for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
        ],
    )
    def test_rst_fixtures(rst_filename, html_filename):
        # Get our Markup
        with open(rst_filename, encoding='utf-8') as f:
            rst_markup = f.read()
        # Get our expected
        with open(html_filename, encoding="utf-8") as f:
            expected = f.read()
        out = render(rst_markup)
        if "<" in expected:
>           assert out == expected
E           assert '<p>Here is s...code></pre>\n' == '<p>Here is s...code></pre>\n'
E             Skipping 216 identical leading characters in diff, use -v to show
E             - >):</span>
E             + >):</span><span class="w">
E             -     <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
E             ? ^^^^^^^^^
E             + </span>    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span><span class="w">
E             ? ^^^^^^^^^^^^^^^^                               ...
E
E             ...Full output truncated (25 lines hidden), use '-vv' to show
tests/test_rst.py:28: AssertionError
miketheman commented 1 year ago

Should already be resolved by #272 It hasn’t been released yet, since the only change was to tests, not functionality.