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

test_intersphinx_all_mappings is unstable #235

Open
benjaoming opened this issue Oct 4, 2022 · 0 comments
Open

test_intersphinx_all_mappings is unstable #235

benjaoming opened this issue Oct 4, 2022 · 0 comments

Comments

@benjaoming
Copy link
Contributor

There was a test error, and I re-ran the tests and they pass on the second attempt.

It seems test_intersphinx_all_mappings is unstable?

py38-sphinx24 create: /home/circleci/project/.tox/py38-sphinx24
py38-sphinx24 installdeps: pytest, pdbpp, sphinxcontrib-bibtex, ., sphinx~=2.4.0, docutils<0.18, jinja2<3.1.0
py38-sphinx24 inst: /home/circleci/project/.tox/.tmp/package/1/sphinx-hoverxref-1.1.3.tar.gz
py38-sphinx24 installed: alabaster==0.7.12,attrs==22.1.0,Babel==2.10.3,certifi==2022.9.24,charset-normalizer==2.1.1,docutils==0.17.1,fancycompleter==0.9.1,idna==3.4,imagesize==1.4.1,importlib-metadata==5.0.0,iniconfig==1.1.1,Jinja2==3.0.3,latexcodec==2.0.1,MarkupSafe==2.1.1,packaging==21.3,pdbpp==0.10.3,pluggy==1.0.0,py==1.11.0,pybtex==0.24.0,pybtex-docutils==1.0.2,Pygments==2.13.0,pyparsing==3.0.9,pyrepl==0.9.0,pytest==7.1.3,pytz==2022.4,PyYAML==6.0,requests==2.28.1,six==1.16.0,snowballstemmer==2.2.0,Sphinx==2.4.5,sphinx-hoverxref @ file:///home/circleci/project/.tox/.tmp/package/1/sphinx-hoverxref-1.1.3.tar.gz,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-bibtex==2.5.0,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==2.0.0,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.5,tomli==2.0.1,urllib3==1.26.12,wmctrl==0.4,zipp==3.8.1
py38-sphinx24 run-test-pre: PYTHONHASHSEED='3359466892'
py38-sphinx24 run-test: commands[0] | pytest
============================= test session starts ==============================
platform linux -- Python 3.8.14, pytest-7.1.3, pluggy-1.0.0
cachedir: .tox/py38-sphinx24/.pytest_cache
rootdir: /home/circleci/project, configfile: pytest.ini
collecting ... collected 14 items                                                             

tests/test_htmltag.py ............F                                      [ 92%]
tests/test_internals.py .                                                [100%]

=================================== FAILURES ===================================
________________________ test_intersphinx_all_mappings _________________________

app = <SphinxTestApp buildername='html'>
status = <_io.StringIO object at 0x7f0964a5f790>
warning = <_io.StringIO object at 0x7f096491b820>

    @pytest.mark.sphinx(
        srcdir=intersphinxsrc,
        confoverrides={
            'hoverxref_intersphinx': [
                'readthedocs',
                'python',
            ],
            'hoverxref_intersphinx_types': {
                'readthedocs': 'modal',
                'python': {
                    'class': 'modal',
                }
            },
            'hoverxref_domains': ['py'],
            'default_role': 'obj',
        },
    )
    def test_intersphinx_all_mappings(app, status, warning):
        app.build()
        path = app.outdir / 'index.html'
        assert path.exists() is True
        content = open(path).read()
    
        chunks_regex = [
            # Python's links do have hoverxref enabled
            r'<a class="hxr-hoverxref hxr-tooltip reference external" href="https://docs.python.org/3/tutorial/index.html#tutorial-index" title="\(in Python v3.\d\d?\)"><span class="xref std std-ref">This a :ref: to The Python Tutorial using intersphinx</span></a>',
            r'<a class="hxr-hoverxref hxr-tooltip reference external" href="https://docs.python.org/3/library/datetime.html#datetime-datetime" title="\(in Python v3.\d\d?\)"><span class="xref std std-ref">This a :ref: to datetime.datetime Python’s function using intersphinx</span></a>',
            r'<a class="hxr-hoverxref hxr-modal reference external" href="https://docs.python.org/3/library/functions.html#float" title="\(in Python v3.\d\d?\)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>',
    
            # Read the Docs' link does have hoverxref enabled
            r'<a class="hxr-hoverxref hxr-modal reference external" href="https://docs.readthedocs.io/en/stable/config-file/v2.html#python" title="\(in Read the Docs user documentation v\d\d?.\d\d?.\d+\)"><span class="xref std std-ref">This a :ref: to Config File v2 Read the Docs’ page using intersphinx</span></a>',
    
            # Using `default_role = 'obj'`
            # Note the difference with the same `float` line previouly. Here it uses `py-obj` instead of `py-class`.
            r'<a class="hxr-hoverxref hxr-tooltip reference external" href="https://docs.python.org/3/library/functions.html#float" title="\(in Python v3.\d\d?\)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">float</span></code></a>'
        ]
    
        chunks = [
            # Python domain's link does have hoverxref enabled
            '<a class="hxr-hoverxref hxr-tooltip reference internal" href="#hoverxref.extension.setup" title="hoverxref.extension.setup"><code class="xref py py-func docutils literal notranslate"><span class="pre">hoverxref.extension.setup()</span></code></a>',
        ]
    
        for chunk in chunks:
            assert chunk in content
    
        for chunk in chunks_regex:
>           assert re.search(chunk, content)
E           assert None
E            +  where None = <function search at 0x7f09696a0dc0>('<a class="hxr-hoverxref hxr-modal reference external" href="https://docs.readthedocs.io/en/stable/config-file/v2.html...\d+\\)"><span class="xref std std-ref">This a :ref: to Config File v2 Read the Docs’ page using intersphinx</span></a>', '\n<!DOCTYPE html>\n\n<html xmlns="http://www.w3.org/1999/xhtml">\n  <head>\n    <meta charset="utf-8" /><meta name="g...ref="_sources/index.rst.txt"\n          rel="nofollow">Page source</a>\n    </div>\n\n    \n\n    \n  </body>\n</html>')
E            +    where <function search at 0x7f09696a0dc0> = re.search

tests/test_htmltag.py:373: AssertionError
--------------------------- Captured stdout teardown ---------------------------

Originally posted by @benjaoming in #234 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant