executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
757 stars 196 forks source link

4.0.0: pytest fails in `tests/test_renderers/test_fixtures_sphinx.py::test_amsmath[38-In list:]` unit #981

Closed kloczek closed 2 weeks ago

kloczek commented 1 month ago

What version of myst-parser are you using?

4.0.0

What version dependencies are you using?

Package                       Version
----------------------------- -----------
alabaster                     0.7.16
Babel                         2.15.0
beautifulsoup4                4.12.3
build                         1.2.2
charset-normalizer            3.3.2
defusedxml                    0.7.1
distro                        1.9.0
docutils                      0.20.1
exceptiongroup                1.1.3
imagesize                     1.4.1
importlib_metadata            8.0.0
iniconfig                     2.0.0
installer                     0.7.0
Jinja2                        3.1.4
linkify-it-py                 2.0.3
markdown-it-py                3.0.0
MarkupSafe                    2.1.5
mdit-py-plugins               0.4.2
mdurl                         0.1.2
packaging                     24.0
pluggy                        1.5.0
Pygments                      2.18.0
pyproject_hooks               1.0.0
pytest                        8.2.2
pytest-datadir                1.5.0
pytest_param_files            0.6.0
pytest-regressions            2.5.0
python-dateutil               2.9.0.post0
PyYAML                        6.0.2
requests                      2.32.3
ruamel.yaml                   0.18.5
ruamel.yaml.clib              0.2.8
snowballstemmer               2.2.0
soupsieve                     2.6
Sphinx                        8.0.2
sphinx_pytest                 0.2.0
sphinxcontrib-applehelp       2.0.0
sphinxcontrib-devhelp         1.0.6
sphinxcontrib-htmlhelp        2.1.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          2.0.0
sphinxcontrib-serializinghtml 2.0.0
tokenize_rt                   6.0.0
tomli                         2.0.1
typing_extensions             4.12.2
uc-micro-py                   1.0.3
urllib3                       2.2.2
wheel                         0.44.0
zipp                          3.19.2

What operating system are you using?

Linux

Describe the Bug

Looks like pytest fails in one unit.

Here is pytest output: ```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-myst-parser-4.0.0~no_loopy_deps-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-myst-parser-4.0.0~no_loopy_deps-2.fc37.x86_64/usr/lib/python3.10/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.10.14, pytest-8.2.2, pluggy-1.5.0 rootdir: /home/tkloczko/rpmbuild/BUILD/MyST-Parser-4.0.0 configfile: pyproject.toml plugins: datadir-1.5.0, sphinx_pytest-0.2.0, regressions-2.5.0, pytest_param_files-0.6.0 collected 1095 items tests/test_anchors.py . [ 0%] tests/test_commonmark/test_commonmark.py .............s...................................................s.s........................................................................ [ 12%] ..................................................................................................................................................................................... [ 29%] ..................................................................................................................................................................................... [ 45%] ................................................................................................................................................... [ 59%] tests/test_docutils.py ........... [ 60%] tests/test_html/test_html_to_nodes.py ................. [ 61%] tests/test_html/test_parse_html.py ..................... [ 63%] tests/test_inventory.py .............. [ 65%] tests/test_renderers/test_error_reporting.py ................... [ 66%] tests/test_renderers/test_fixtures_docutils.py ................................................................................................. [ 75%] tests/test_renderers/test_fixtures_sphinx.py ......................................................................s...........s.s.........s..s................ss.................... [ 88%] ..........s.................F.......... [ 91%] tests/test_renderers/test_include_directive.py ........ [ 92%] tests/test_renderers/test_myst_config.py ........................ [ 94%] tests/test_renderers/test_myst_refs.py ......... [ 95%] tests/test_renderers/test_parse_directives.py ................................. [ 98%] tests/test_sphinx/test_sphinx_builds.py ................. [100%] ========================================================================================= FAILURES ========================================================================================== _________________________________________________________________________________ test_amsmath[38-In list:] _________________________________________________________________________________ file_params = ParamTestData(line=38, title='In list:', description=None, content='- \\begin{equation}\n a = 1\n \\end{equation}\n'... \\end{equation}\n', index=3, fmt=, extra={}) sphinx_doctree_no_tr = , monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f4453a82500> @pytest.mark.param_file(FIXTURE_PATH / "amsmath.md") def test_amsmath( file_params: ParamTestData, sphinx_doctree_no_tr: CreateDoctree, monkeypatch ): monkeypatch.setattr(SphinxRenderer, "_random_label", lambda self: "mock-uuid") sphinx_doctree_no_tr.set_conf( {"extensions": ["myst_parser"], "myst_enable_extensions": ["amsmath"]} ) result = sphinx_doctree_no_tr(file_params.content, "index.md") > file_params.assert_expected(result.pformat("index"), rstrip_lines=True) E AssertionError: actual != expected (use --regen-file-failure) E --- /home/tkloczko/rpmbuild/BUILD/MyST-Parser-4.0.0/tests/test_renderers/fixtures/amsmath.md:38 E +++ (actual) E @@ -4,5 +4,5 @@ E E E \begin{equation} E - a = 1 E - \end{equation} E + a = 1 E + \end{equation} tests/test_renderers/test_fixtures_sphinx.py:165: AssertionError ================================================================================== short test summary info ================================================================================== SKIPPED [1] tests/test_commonmark/test_commonmark.py:24: Expects '+++' to be unconverted (not block break). SKIPPED [2] tests/test_commonmark/test_commonmark.py:29: Thematic breaks on the first line conflict with front matter syntax SKIPPED [2] tests/test_renderers/test_fixtures_sphinx.py:95: SKIP: Tested in sphinx builds SKIPPED [1] tests/test_renderers/test_fixtures_sphinx.py:95: SKIP: MockingError: MockState has not yet implemented attribute 'nested_list_parse' SKIPPED [1] tests/test_renderers/test_fixtures_sphinx.py:95: SPHINX4-SKIP productionlist (`sphinx.domains.std.ProductionList`): SKIPPED [1] tests/test_renderers/test_fixtures_sphinx.py:95: SPHINX4-SKIP rst:directive:option (`sphinx.domains.rst.ReSTDirectiveOption`): SKIPPED [1] tests/test_renderers/test_fixtures_sphinx.py:132: SKIP cpp:expr (`sphinx.domains.cpp.CPPExprRole`): SKIPPED [1] tests/test_renderers/test_fixtures_sphinx.py:132: SKIP cpp:texpr (`sphinx.domains.cpp.CPPExprRole`): SKIPPED [1] tests/test_renderers/test_fixtures_sphinx.py:132: SKIP: Non-deterministic output FAILED tests/test_renderers/test_fixtures_sphinx.py::test_amsmath[38-In list:] - AssertionError: actual != expected (use --regen-file-failure) ======================================================================== 1 failed, 1083 passed, 11 skipped in 12.13s ======================================================================== ```

Expected Behavior

pytest should not fail

To Reproduce

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

kloczek commented 1 month ago

As long as in pyprojecct.toml is requires-python = ">=3.10" and this unit has name suggests that is is related to python 3.8 I think it is possibility that this unit can be removed.

heirecka commented 2 weeks ago

Pretty sure that this is fixed by 8ea56455aa87feb2d96bf29c335bca5dc885b77b

kloczek commented 2 weeks ago

BTW: because python 3.8 has been EOSed last year this unit can be removed.