mgedmin / restview

ReStructuredText viewer

Home Page:https://pypi.python.org/pypi/restview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test breakage with docutils 0.18.1

mgedmin opened this issue · comments

docutils 0.18.1 causes two test failures:

=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
cachedir: .tox/py39/.pytest_cache
rootdir: /home/mg/src/restview, configfile: setup.cfg
collected 74 items                                                                                                                                                                                                

src/restview/restviewhttp.py ..                                                                                                                                                                             [  2%]
src/restview/tests.py ...F....................................................F...............                                                                                                              [100%]

==================================================================================================== FAILURES =====================================================================================================
____________________________________________________________________________ [doctest] restview.tests.doctest_RestViewer_rest_to_html _____________________________________________________________________________
530 Test for RestViewer.rest_to_html
531 
532         >>> viewer = RestViewer('.')
533         >>> print(viewer.rest_to_html(b'''
Differences (unified diff with -expected +actual):
    @@ -4,12 +4,83 @@
     <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    -...
    +<meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
     <title>example</title>
    +<--- Cannot embed stylesheet ''html4css1.css'': No such file or directory. --->
    +<--- Cannot embed stylesheet ''restview.css'': No such file or directory. --->
     <style type="text/css">
    -...
    -/*
    - * Stylesheet overrides for ReSTview
    - */
    -...
    +pre { line-height: 125%; }
    +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
    +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
    +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
    +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
    +pre .hll { background-color: #ffffcc }
    +pre { background: #ffffff; }
    +pre .c { color: #888888 } /* Comment */
    +pre .err { color: #FF0000; background-color: #FFAAAA } /* Error */
    +pre .k { color: #008800; font-weight: bold } /* Keyword */
    +pre .o { color: #333333 } /* Operator */
    +pre .ch { color: #888888 } /* Comment.Hashbang */
    +pre .cm { color: #888888 } /* Comment.Multiline */
    +pre .cp { color: #557799 } /* Comment.Preproc */
    +pre .cpf { color: #888888 } /* Comment.PreprocFile */
    +pre .c1 { color: #888888 } /* Comment.Single */
    +pre .cs { color: #cc0000; font-weight: bold } /* Comment.Special */
    +pre .gd { color: #A00000 } /* Generic.Deleted */
    +pre .ge { font-style: italic } /* Generic.Emph */
    +pre .gr { color: #FF0000 } /* Generic.Error */
    +pre .gh { color: #000080; font-weight: bold } /* Generic.Heading */
    +pre .gi { color: #00A000 } /* Generic.Inserted */
    +pre .go { color: #888888 } /* Generic.Output */
    +pre .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
    +pre .gs { font-weight: bold } /* Generic.Strong */
    +pre .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
    +pre .gt { color: #0044DD } /* Generic.Traceback */
    +pre .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
    +pre .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
    +pre .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
    +pre .kp { color: #003388; font-weight: bold } /* Keyword.Pseudo */
    +pre .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
    +pre .kt { color: #333399; font-weight: bold } /* Keyword.Type */
    +pre .m { color: #6600EE; font-weight: bold } /* Literal.Number */
    +pre .s { background-color: #fff0f0 } /* Literal.String */
    +pre .na { color: #0000CC } /* Name.Attribute */
    +pre .nb { color: #007020 } /* Name.Builtin */
    +pre .nc { color: #BB0066; font-weight: bold } /* Name.Class */
    +pre .no { color: #003366; font-weight: bold } /* Name.Constant */
    +pre .nd { color: #555555; font-weight: bold } /* Name.Decorator */
    +pre .ni { color: #880000; font-weight: bold } /* Name.Entity */
    +pre .ne { color: #FF0000; font-weight: bold } /* Name.Exception */
    +pre .nf { color: #0066BB; font-weight: bold } /* Name.Function */
    +pre .nl { color: #997700; font-weight: bold } /* Name.Label */
    +pre .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
    +pre .nt { color: #007700 } /* Name.Tag */
    +pre .nv { color: #996633 } /* Name.Variable */
    +pre .ow { color: #000000; font-weight: bold } /* Operator.Word */
    +pre .w { color: #bbbbbb } /* Text.Whitespace */
    +pre .mb { color: #6600EE; font-weight: bold } /* Literal.Number.Bin */
    +pre .mf { color: #6600EE; font-weight: bold } /* Literal.Number.Float */
    +pre .mh { color: #005588; font-weight: bold } /* Literal.Number.Hex */
    +pre .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
    +pre .mo { color: #4400EE; font-weight: bold } /* Literal.Number.Oct */
    +pre .sa { background-color: #fff0f0 } /* Literal.String.Affix */
    +pre .sb { background-color: #fff0f0 } /* Literal.String.Backtick */
    +pre .sc { color: #0044DD } /* Literal.String.Char */
    +pre .dl { background-color: #fff0f0 } /* Literal.String.Delimiter */
    +pre .sd { color: #DD4422 } /* Literal.String.Doc */
    +pre .s2 { background-color: #fff0f0 } /* Literal.String.Double */
    +pre .se { color: #666666; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */
    +pre .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */
    +pre .si { background-color: #eeeeee } /* Literal.String.Interpol */
    +pre .sx { color: #DD2200; background-color: #fff0f0 } /* Literal.String.Other */
    +pre .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */
    +pre .s1 { background-color: #fff0f0 } /* Literal.String.Single */
    +pre .ss { color: #AA6600 } /* Literal.String.Symbol */
    +pre .bp { color: #007020 } /* Name.Builtin.Pseudo */
    +pre .fm { color: #0066BB; font-weight: bold } /* Name.Function.Magic */
    +pre .vc { color: #336699 } /* Name.Variable.Class */
    +pre .vg { color: #dd7700; font-weight: bold } /* Name.Variable.Global */
    +pre .vi { color: #3333BB } /* Name.Variable.Instance */
    +pre .vm { color: #996633 } /* Name.Variable.Magic */
    +pre .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
     </style>
     </head>

/home/mg/src/restview/src/restview/tests.py:533: DocTestFailure
---------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------
<string>:: (ERROR/3) Cannot embed stylesheet ''html4css1.css'': No such file or directory.
<string>:: (ERROR/3) Cannot embed stylesheet ''restview.css'': No such file or directory.
___________________________________________________________________________ TestRestViewer.test_rest_to_html_pypi_strict_clean_failure ____________________________________________________________________________

self = <restview.tests.TestRestViewer testMethod=test_rest_to_html_pypi_strict_clean_failure>

    @patch('readme_renderer.rst.clean', Mock(return_value=None))
    def test_rest_to_html_pypi_strict_clean_failure(self):
        # Certain versions of readme_renderer could return `None`
        # from the clean() helper.  New versions don't (or at least
        # do in different circumstances), so we have to mock out
        # the helper to keep this test.
        viewer = RestViewer('.')
        viewer.pypi_strict = True
        html = viewer.rest_to_html(b'''
            [http://localhost:3000](http://localhost:3000)
        ''')
>       self.assertIn('<title>ValueError</title>', html)
E       AssertionError: '<title>ValueError</title>' not found in '<!DOCTYPE html>\n<html>\n<head>\n<title>SystemMessage</title>\n<style type="text/css">\npre.error {\n    border-left: 1ex solid red;\n    padding-left: 1.5em;\n    padding-top: 1em;\n    padding-bottom: 1em;\n    color: red;\n    background: #fff8f8;\n}\npre > .highlight {\n    display: block;\n    color: red;\n    background: #fff8f8;\n}\n</style>\n</head>\n<body>\n<h1>SystemMessage</h1>\n<pre class="error">\n&lt;string&gt;:4: (ERROR/3) Cannot embed stylesheet &#x27;&#x27;html4css1.css&#x27;&#x27;: No such file or directory.\n</pre>\n<pre>\n\n            [http://localhost:3000](http://localhost:3000)\n        \n</pre>\n</body>\n</html>\n'

src/restview/tests.py:853: AssertionError
---------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------
<string>:4: (ERROR/3) Cannot embed stylesheet ''html4css1.css'': No such file or directory.
============================================================================================= short test summary info =============================================================================================
FAILED src/restview/tests.py::restview.tests.doctest_RestViewer_rest_to_html
FAILED src/restview/tests.py::TestRestViewer::test_rest_to_html_pypi_strict_clean_failure - AssertionError: '<title>ValueError</title>' not found in '<!DOCTYPE html>\n<html>\n<head>\n<title>SystemMessage</tit...
========================================================================================== 2 failed, 72 passed in 0.34s ===========================================================================================

Downgrading to docutils 0.18 fixes them.

This needs investigation & fixing.