readthedocs / sphinx-notfound-page

Create a custom 404 page with absolute URLs hardcoded
https://sphinx-notfound-page.readthedocs.io/
MIT License
51 stars 33 forks source link

1.0.4: pytest fails in 8 units #249

Open kloczek opened 1 month ago

kloczek commented 1 month ago

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.

Here is pytest output: ```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-notfound-page-1.0.4-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-notfound-page-1.0.4-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/sphinx-notfound-page-1.0.4 configfile: pytest.ini collected 21 items tests/test_urls.py ...F..FF.F...F.FFF... [100%] =================================== FAILURES =================================== ____________________________ test_default_settings _____________________________ app = status = <_io.StringIO object at 0x7f0899175a20> warning = <_io.StringIO object at 0x7f0899175b40> @pytest.mark.sphinx(srcdir=srcdir) def test_default_settings(app, status, warning): app.build() path = app.outdir / '404.html' assert path.exists() content = path.read_text() if sphinx.version_info < (6, 0): cssclass = "shortcut " else: cssclass = "" if sphinx.version_info < (7, 3): alt = "Logo" else: alt = "Logo of Python" chunks = [ '

Page not found

', "Unfortunately we couldn't find the content you were looking for.", 'Page not found — Python documentation', # favicon and logo f'', f'', # sidebar URLs '

Python

', '
\n \n' tests/test_urls.py:93: AssertionError --------------------------- Captured stdout teardown --------------------------- # testroot: root # builder: html # srcdir: /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default # outdir: /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default/_build/html # status: Running Sphinx v8.1.3 loading translations [en]... done building [mo]: targets for 0 po files that are out of date writing output... building [html]: targets for 3 source files that are out of date updating environment: [new config] 3 added, 0 changed, 0 removed reading sources... [ 33%] chapter reading sources... [ 67%] chapter-i reading sources... [100%] index looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done copying assets... copying static files... Writing evaluated template result to /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default/_build/html/_static/basic.css Writing evaluated template result to /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default/_build/html/_static/documentation_options.js Writing evaluated template result to /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default/_build/html/_static/language_data.js copying static files: done copying extra files... copying extra files: done copying assets: done writing output... [ 33%] chapter writing output... [ 67%] chapter-i writing output... [100%] index generating indices... genindex done writing additional pages... search done dumping search index in English (code: en)... done dumping object inventory... done build succeeded. The HTML pages are in tests/examples/default/_build/html. # warning: ___________________________ test_urls_prefix_setting ___________________________ app = status = <_io.StringIO object at 0x7f089908b0a0> warning = <_io.StringIO object at 0x7f089908b010> @pytest.mark.sphinx( srcdir=srcdir, confoverrides={ 'notfound_urls_prefix': '/language/version/', }, ) def test_urls_prefix_setting(app, status, warning): app.build() path = app.outdir / '404.html' assert path.exists() content = path.read_text() if sphinx.version_info < (6, 0): cssclass = "shortcut " else: cssclass = "" if sphinx.version_info < (7, 3): alt = "Logo" else: alt = "Logo of Python" chunks = [ # sidebar URLs '

Python

', '', '
  • Documentation overview
      ', # favicon and logo f'', f'', # resources _get_css_html_link_tag(app, 'language', 'version', 'alabaster.css'), _get_css_html_link_tag(app, 'language', 'version', 'pygments.css'), '', ] for chunk in chunks: > assert chunk in content E assert '

      Python

      ' in '\n\n\n \n \n Sphinx 8.1.3.\n
  • \n \n' tests/test_urls.py:169: AssertionError --------------------------- Captured stdout teardown --------------------------- # testroot: root # builder: html # srcdir: /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default # outdir: /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default/_build/html # status: Running Sphinx v8.1.3 loading translations [en]... done building [mo]: targets for 0 po files that are out of date writing output... building [html]: targets for 3 source files that are out of date updating environment: [new config] 3 added, 0 changed, 0 removed reading sources... [ 33%] chapter reading sources... [ 67%] chapter-i reading sources... [100%] index looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done copying assets... copying static files... Writing evaluated template result to /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default/_build/html/_static/basic.css Writing evaluated template result to /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default/_build/html/_static/documentation_options.js Writing evaluated template result to /home/tkloczko/rpmbuild/BUILD/sphinx-notfound-page-1.0.4/tests/examples/default/_build/html/_static/language_data.js copying static files: done copying extra files... copying extra files: done copying assets: done writing output... [ 33%] chapter writing output... [ 67%] chapter-i writing output... [100%] index generating indices... genindex done writing additional pages... search done dumping search index in English (code: en)... done dumping object inventory... done build succeeded. The HTML pages are in tests/examples/default/_build/html. # warning: ________________________ test_urls_prefix_setting_none _________________________ app = status = <_io.StringIO object at 0x7f089908a290> warning = <_io.StringIO object at 0x7f08990db400> @pytest.mark.sphinx( srcdir=srcdir, confoverrides={ 'notfound_urls_prefix': None, }, ) def test_urls_prefix_setting_none(app, status, warning): app.build() path = app.outdir / '404.html' assert path.exists() content = path.read_text() if sphinx.version_info < (6, 0): cssclass = "shortcut " else: cssclass = "" if sphinx.version_info < (7, 3): alt = "Logo" else: alt = "Logo of Python" chunks = [ # sidebar URLs '

    Python

    ', '', '
  • Documentation overview