Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 test failures: #645

Closed
Apteryks opened this issue Nov 5, 2022 · 2 comments
Closed

3 test failures: #645

Apteryks opened this issue Nov 5, 2022 · 2 comments
Labels
more-info-required More information is required to fix the issue

Comments

@Apteryks
Copy link

Apteryks commented Nov 5, 2022

Describe the bug

context
When I run the test suite,

expectation
I expect it to pass.

bug
But instead there are 3 test failures

Here's an error message I ran into...

=================================== FAILURES ===================================
__________________________________ test_basic __________________________________

app = <SphinxTestApp buildername='html'>
status = <_io.StringIO object at 0x7ffff33025e0>
warning = <_io.StringIO object at 0x7ffff33ded30>
get_sphinx_app_doctree = <function get_sphinx_app_doctree.<locals>.read at 0x7ffff32860d0>
get_sphinx_app_output = <function get_sphinx_app_output.<locals>.read at 0x7ffff308b8b0>

    @pytest.mark.sphinx(
        buildername="html",
        srcdir=os.path.join(SOURCE_DIR, "basic"),
        freshenv=True,
        confoverrides={"myst_enable_extensions": ["dollarmath"]},
    )
    def test_basic(
        app,
        status,
        warning,
        get_sphinx_app_doctree,
        get_sphinx_app_output,
    ):
        """basic test."""
        app.build()
    
        assert "build succeeded" in status.getvalue()  # Build succeeded
        warnings = warning.getvalue().strip()
        assert warnings == ""
    
        try:
            get_sphinx_app_doctree(
                app,
                docname="content",
                regress=True,
            )
        finally:
            get_sphinx_app_doctree(
                app,
                docname="content",
                resolve=True,
                regress=True,
            )
>       get_sphinx_app_output(
            app,
            filename="content.html",
            regress_html=True,
            regress_ext=f".sphinx{sphinx.version_info[0]}.html",
        )

tests/test_sphinx/test_sphinx_builds.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

app = <SphinxTestApp buildername='html'>, buildername = 'html'
filename = 'content.html', encoding = 'utf-8', regress_html = True
regress_ext = '.sphinx5.html', replace = None

    def read(
        app,
        buildername="html",
        filename="index.html",
        encoding="utf-8",
        regress_html=False,
        regress_ext=".html",
        replace=None,
    ):
    
        outpath = path(os.path.join(str(app.srcdir), "_build", buildername, filename))
        if not outpath.exists():
            raise OSError(f"no output file exists: {outpath}")
    
        try:
            # introduced in sphinx 3.0
            content = outpath.read_text(encoding=encoding)
        except AttributeError:
            content = outpath.text(encoding=encoding)
    
        if regress_html:
            # only regress the inner body, since other sections are non-deterministic
            soup = BeautifulSoup(content, "html.parser")
            doc_div = soup.findAll("div", {"class": "documentwrapper"})[0]
            # pygments 2.11.0 introduces a whitespace tag
            for pygment_whitespace in doc_div.select("pre > span.w"):
                pygment_whitespace.replace_with(pygment_whitespace.text)
            text = doc_div.prettify()
            for find, rep in (replace or {}).items():
                text = text.replace(find, rep)
>           file_regression.check(text, extension=regress_ext, encoding="utf8")
E           AssertionError: FILES DIFFER:
E           /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_basic0/test_sphinx_builds/test_basic.sphinx5.html
E           /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_basic0/test_sphinx_builds/test_basic.sphinx5.obtained.sphinx5.html
E           HTML DIFF: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_basic0/test_sphinx_builds/test_basic.sphinx5.obtained.sphinx5.diff.html
E           --- 
E           +++ 
E           @@ -1,7 +1,7 @@
E            <div class="documentwrapper">
E             <div class="bodywrapper">
E              <div class="body" role="main">
E           -   <div class="topic dedication" role="doc-dedication">
E           +   <div class="dedication topic">
E                <p class="topic-title">
E                 Dedication
E                </p>
E           @@ -12,7 +12,7 @@
E                 </em>
E                </p>
E               </div>
E           -   <div class="topic abstract" role="doc-abstract">
E           +   <div class="abstract topic">
E                <p class="topic-title">
E                 Abstract
E                </p>
E           @@ -138,7 +138,7 @@
E                  </span>
E                 </code>
E                </p>
E           -    <table class="docutils align-default">
E           +    <table class="colwidths-auto docutils align-default">
E                 <thead>
E                  <tr class="row-odd">
E                   <th class="head">
E           @@ -146,7 +146,7 @@
E                     a
E                    </p>
E                   </th>
E           -       <th class="head text-right">
E           +       <th class="text-right head">
E                    <p>
E                     b
E                    </p>

tests/test_sphinx/conftest.py:89: AssertionError
--------------------------- Captured stdout teardown ---------------------------
# testroot: root
# builder: html
# srcdir: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/source/tests/test_sphinx/sourcedirs/basic
# outdir: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/source/tests/test_sphinx/sourcedirs/basic/_build/html
# status: 
Running Sphinx v5.1.1
myst v0.18.1: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=['dollarmath'], disable_syntax=[], all_links_external=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, highlight_code_blocks=True, number_code_blocks=[], title_to_header=False, heading_anchors=None, heading_slug_func=None, footnote_transition=True, words_per_minute=200, sub_delimiters=('{', '}'), linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area')
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 3 source files that are out of date
updating environment: [new config] 3 added, 0 changed, 0 removed
reading sources... [100%] orphan                                               
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] orphan                                                
generating indices... genindex done
writing additional pages... search done
copying images... [100%] example.jpg                                           
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in tests/test_sphinx/sourcedirs/basic/_build/html.

# warning: 

______________________________ test_gettext_html _______________________________

app = <SphinxTestApp buildername='html'>
status = <_io.StringIO object at 0x7ffff2f08700>
warning = <_io.StringIO object at 0x7ffff2f089d0>
get_sphinx_app_doctree = <function get_sphinx_app_doctree.<locals>.read at 0x7ffff2b3bf70>
get_sphinx_app_output = <function get_sphinx_app_output.<locals>.read at 0x7ffff2fab1f0>

    @pytest.mark.sphinx(
        buildername="html",
        srcdir=os.path.join(SOURCE_DIR, "gettext"),
        freshenv=True,
        confoverrides={"language": "fr", "gettext_compact": False, "locale_dirs": ["."]},
    )
    def test_gettext_html(
        app,
        status,
        warning,
        get_sphinx_app_doctree,
        get_sphinx_app_output,
    ):
        """Test gettext message extraction."""
        app.build()
        assert "build succeeded" in status.getvalue()  # Build succeeded
        warnings = warning.getvalue().strip()
        assert warnings == ""
    
        try:
            get_sphinx_app_doctree(
                app,
                docname="index",
                regress=True,
            )
        finally:
            get_sphinx_app_doctree(
                app,
                docname="index",
                resolve=True,
                regress=True,
            )
>       get_sphinx_app_output(
            app,
            filename="index.html",
            regress_html=True,
            regress_ext=f".sphinx{sphinx.version_info[0]}.html",
        )

tests/test_sphinx/test_sphinx_builds.py:447: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

app = <SphinxTestApp buildername='html'>, buildername = 'html'
filename = 'index.html', encoding = 'utf-8', regress_html = True
regress_ext = '.sphinx5.html', replace = None

    def read(
        app,
        buildername="html",
        filename="index.html",
        encoding="utf-8",
        regress_html=False,
        regress_ext=".html",
        replace=None,
    ):
    
        outpath = path(os.path.join(str(app.srcdir), "_build", buildername, filename))
        if not outpath.exists():
            raise OSError(f"no output file exists: {outpath}")
    
        try:
            # introduced in sphinx 3.0
            content = outpath.read_text(encoding=encoding)
        except AttributeError:
            content = outpath.text(encoding=encoding)
    
        if regress_html:
            # only regress the inner body, since other sections are non-deterministic
            soup = BeautifulSoup(content, "html.parser")
            doc_div = soup.findAll("div", {"class": "documentwrapper"})[0]
            # pygments 2.11.0 introduces a whitespace tag
            for pygment_whitespace in doc_div.select("pre > span.w"):
                pygment_whitespace.replace_with(pygment_whitespace.text)
            text = doc_div.prettify()
            for find, rep in (replace or {}).items():
                text = text.replace(find, rep)
>           file_regression.check(text, extension=regress_ext, encoding="utf8")
E           AssertionError: FILES DIFFER:
E           /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_gettext_html0/test_sphinx_builds/test_gettext_html.sphinx5.html
E           /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_gettext_html0/test_sphinx_builds/test_gettext_html.sphinx5.obtained.sphinx5.html
E           HTML DIFF: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_gettext_html0/test_sphinx_builds/test_gettext_html.sphinx5.obtained.sphinx5.diff.html
E           --- 
E           +++ 
E           @@ -74,7 +74,7 @@
E                  </p>
E                 </dd>
E                </dl>
E           -    <table class="docutils align-default">
E           +    <table class="colwidths-auto docutils align-default">
E                 <thead>
E                  <tr class="row-odd">
E                   <th class="head">

tests/test_sphinx/conftest.py:89: AssertionError
--------------------------- Captured stdout teardown ---------------------------
# testroot: root
# builder: html
# srcdir: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/source/tests/test_sphinx/sourcedirs/gettext
# outdir: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/source/tests/test_sphinx/sourcedirs/gettext/_build/html
# status: 
Running Sphinx v5.1.1
loading translations [fr]... done
myst v0.18.1: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=['deflist'], disable_syntax=[], all_links_external=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, highlight_code_blocks=True, number_code_blocks=[], title_to_header=False, heading_anchors=None, heading_slug_func=None, footnote_transition=True, words_per_minute=200, sub_delimiters=('{', '}'), linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area')
building [mo]: targets for 1 po files that are out of date
writing output... [100%] fr/LC_MESSAGES/index.mo                               
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                 
generating indices... genindex done
writing additional pages... search done
copying images... [100%] fun-fish.png                                          
copying static files... done
copying extra files... done
dumping search index in French (code: fr)... done
dumping object inventory... done
build succeeded.

The HTML pages are in tests/test_sphinx/sourcedirs/gettext/_build/html.

# warning: 

___________________________ test_fieldlist_extension ___________________________

app = <SphinxTestApp buildername='html'>
status = <_io.StringIO object at 0x7ffff2dc73a0>
warning = <_io.StringIO object at 0x7ffff2dc7dc0>
get_sphinx_app_doctree = <function get_sphinx_app_doctree.<locals>.read at 0x7ffff2dc7040>
get_sphinx_app_output = <function get_sphinx_app_output.<locals>.read at 0x7ffff2dc74c0>

    @pytest.mark.sphinx(
        buildername="html",
        srcdir=os.path.join(SOURCE_DIR, "fieldlist"),
        freshenv=True,
    )
    def test_fieldlist_extension(
        app,
        status,
        warning,
        get_sphinx_app_doctree,
        get_sphinx_app_output,
    ):
        """test setting addition configuration values."""
        app.build()
        assert "build succeeded" in status.getvalue()  # Build succeeded
        warnings = warning.getvalue().strip()
        assert warnings == ""
    
        try:
            get_sphinx_app_doctree(
                app,
                docname="index",
                regress=True,
                # changed in:
                # https://www.sphinx-doc.org/en/master/changes.html#release-4-4-0-released-jan-17-2022
                replace={
                    (
                        '<literal_strong py:class="True" '
                        'py:module="True" refspecific="True">'
                    ): "<literal_strong>"
                },
            )
        finally:
>           get_sphinx_app_output(
                app,
                filename="index.html",
                regress_html=True,
                regress_ext=f".sphinx{sphinx.version_info[0]}.html",
            )

tests/test_sphinx/test_sphinx_builds.py:543: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

app = <SphinxTestApp buildername='html'>, buildername = 'html'
filename = 'index.html', encoding = 'utf-8', regress_html = True
regress_ext = '.sphinx5.html', replace = None

    def read(
        app,
        buildername="html",
        filename="index.html",
        encoding="utf-8",
        regress_html=False,
        regress_ext=".html",
        replace=None,
    ):
    
        outpath = path(os.path.join(str(app.srcdir), "_build", buildername, filename))
        if not outpath.exists():
            raise OSError(f"no output file exists: {outpath}")
    
        try:
            # introduced in sphinx 3.0
            content = outpath.read_text(encoding=encoding)
        except AttributeError:
            content = outpath.text(encoding=encoding)
    
        if regress_html:
            # only regress the inner body, since other sections are non-deterministic
            soup = BeautifulSoup(content, "html.parser")
            doc_div = soup.findAll("div", {"class": "documentwrapper"})[0]
            # pygments 2.11.0 introduces a whitespace tag
            for pygment_whitespace in doc_div.select("pre > span.w"):
                pygment_whitespace.replace_with(pygment_whitespace.text)
            text = doc_div.prettify()
            for find, rep in (replace or {}).items():
                text = text.replace(find, rep)
>           file_regression.check(text, extension=regress_ext, encoding="utf8")
E           AssertionError: FILES DIFFER:
E           /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_fieldlist_extension0/test_sphinx_builds/test_fieldlist_extension.sphinx5.html
E           /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_fieldlist_extension0/test_sphinx_builds/test_fieldlist_extension.sphinx5.obtained.sphinx5.html
E           HTML DIFF: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/pytest-of-nixbld/pytest-0/test_fieldlist_extension0/test_sphinx_builds/test_fieldlist_extension.sphinx5.obtained.sphinx5.diff.html
E           --- 
E           +++ 
E           @@ -11,9 +11,6 @@
E                <dl class="myst field-list simple">
E                 <dt class="field-odd">
E                  field
E           -      <span class="colon">
E           -       :
E           -      </span>
E                 </dt>
E                 <dd class="field-odd">
E                  <p>
E           @@ -23,9 +20,6 @@
E                  <em>
E                   field
E                  </em>
E           -      <span class="colon">
E           -       :
E           -      </span>
E                 </dt>
E                 <dd class="field-even">
E                  <p>
E           @@ -72,9 +66,6 @@
E                  <dl class="myst field-list simple">
E                   <dt class="field-odd">
E                    Parameters
E           -        <span class="colon">
E           -         :
E           -        </span>
E                   </dt>
E                   <dd class="field-odd">
E                    <ul class="simple">
E           @@ -106,9 +97,6 @@
E                   </dd>
E                   <dt class="field-even">
E                    Returns
E           -        <span class="colon">
E           -         :
E           -        </span>
E                   </dt>
E                   <dd class="field-even">
E                    <p>
E           @@ -117,9 +105,6 @@
E                   </dd>
E                   <dt class="field-odd">
E                    Return type
E           -        <span class="colon">
E           -         :
E           -        </span>
E                   </dt>
E                   <dd class="field-odd">
E                    <p>
E           @@ -128,9 +113,6 @@
E                   </dd>
E                   <dt class="field-even">
E                    Raises
E           -        <span class="colon">
E           -         :
E           -        </span>
E                   </dt>
E                   <dd class="field-even">
E                    <p>

tests/test_sphinx/conftest.py:89: AssertionError
--------------------------- Captured stdout teardown ---------------------------
# testroot: root
# builder: html
# srcdir: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/source/tests/test_sphinx/sourcedirs/fieldlist
# outdir: /tmp/guix-build-python-myst-parser-0.18.1.drv-0/source/tests/test_sphinx/sourcedirs/fieldlist/_build/html
# status: 
Running Sphinx v5.1.1
myst v0.18.1: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=['fieldlist'], disable_syntax=[], all_links_external=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, highlight_code_blocks=True, number_code_blocks=[], title_to_header=False, heading_anchors=None, heading_slug_func=None, footnote_transition=True, words_per_minute=200, sub_delimiters=('{', '}'), linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area')
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                 
generating indices... genindex done
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in tests/test_sphinx/sourcedirs/fieldlist/_build/html.

# warning: 

=========================== short test summary info ============================
FAILED tests/test_sphinx/test_sphinx_builds.py::test_basic - AssertionError: ...
FAILED tests/test_sphinx/test_sphinx_builds.py::test_gettext_html - Assertion...
FAILED tests/test_sphinx/test_sphinx_builds.py::test_fieldlist_extension - As...
================== 3 failed, 999 passed, 13 skipped in 7.73s ==

Reproduce the bug

Run the test suite with an environment similar to described as in the environment section.

List your environment

These are the direct dependencies used by the GNU Guix python-myst-parser package:

python-beautifulsoup4@4.11.1 python-docutils@0.17.1 python-flit-core@3.5.1
+ python-jinja2@3.1.1 python-linkify-it-py@2.0.0 python-markdown-it-py@2.1.0 python-mdit-py-plugins@0.3.1
+ python-pytest-param-files@0.3.4 python-pytest-regressions@2.3.1 python-pytest@6.2.5 python-pyyaml@6.0
+ python-sphinx-pytest@0.0.5 python-sphinx@5.1.1 python-typing-extensions@4.0.1
@Apteryks Apteryks added the bug Something isn't working label Nov 5, 2022
@welcome
Copy link

welcome bot commented Nov 5, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@chrisjsewell chrisjsewell added more-info-required More information is required to fix the issue and removed bug Something isn't working labels Dec 5, 2022
@chrisjsewell
Copy link
Member

Unless it can be replicated in the test suite here (https://github.com/executablebooks/MyST-Parser/actions/workflows/tests.yml), via a PR, then there is not much I can do I'm afraid, as this is all parsing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-info-required More information is required to fix the issue
Projects
None yet
Development

No branches or pull requests

2 participants