[docutils:bugs] #485 0.21.1: `FAIL: test_publish (test_writers.test_html5_polyglot_parts.Html5WriterPublishPartsTestCase.test_publish) (id="totest['image_messages'][0]")`

Günter Milde via Docutils-develop <[email protected]>
Newsgroups gmane.text.docutils.devel
Message-ID </p/docutils/bugs/485/b9dfd8395cfb099376607f1285c8cd60a6939fd2.bugs@docutils.p.sourceforge.net>
- **status**: open --> closed-fixed



---

**[bugs:#485] 0.21.1: `FAIL: test_publish (test_writers.test_html5_polyglot_parts.Html5WriterPublishPartsTestCase.test_publish) (id="totest['image_messages'][0]")`**

**Status:** closed-fixed
**Created:** Thu Apr 11, 2024 02:48 PM UTC by Michał Górny
**Last Updated:** Wed Apr 24, 2024 08:19 AM UTC
**Owner:** nobody


This is one more test failure, introduced by a different commit than these reported in #484:

```
======================================================================
FAIL: test_publish (test_writers.test_html5_polyglot_parts.Html5WriterPublishPartsTestCase.test_publish) (id="totest['image_messages'][0]")
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/docutils/test/test_writers/test_html5_polyglot_parts.py", line 54, in test_publish
    self.assertEqual(case_expected, self.format_output(parts))
AssertionError: {'fra[318 chars]y: \'dummy.png\'</p>\n</aside>\n<aside class="[620 chars]>\n'} != {'fra[318 chars]y: \'/tmp/docutils/test/dummy.png\'</p>\n</asi[639 chars]>\n'}
  {'fragment': '<img alt="dummy.png" src="dummy.png" />\n'
               '<aside class="system-message">\n'
               '<p class="system-message-title">System Message: WARNING/2 (<span '
               'class="docutils literal"><string></span>, line 1)</p>\n'
               '<p>Cannot scale image!\n'
               '  Could not get size from "dummy.png":\n'
-              "  [Errno 2] No such file or directory: 'dummy.png'</p>\n"
?              ^                                        -----------------

+              '  [Errno 2] No such file or directory: '
?              ^

+              "'/tmp/docutils/test/dummy.png'</p>\n"
               '</aside>\n'
               '<aside class="system-message">\n'
               '<p class="system-message-title">System Message: ERROR/3 (<span '
               'class="docutils literal"><string></span>, line 1)</p>\n'
               '<p>Cannot embed image "dummy.png":\n'
               "  [Errno 2] No such file or directory: 'dummy.png'</p>\n"
               '</aside>\n'
               '<video src="dummy.mp4" title="dummy.mp4">\n'
               '<a href="dummy.mp4">dummy.mp4</a>\n'
               '</video>\n'
               '<aside class="system-message">\n'
               '<p class="system-message-title">System Message: WARNING/2 (<span '
               'class="docutils literal"><string></span>, line 5)</p>\n'
               '<p>Cannot scale image!\n'
               '  Could not get size from "dummy.mp4":\n'
               '  PIL cannot read video images.</p>\n'
               '</aside>\n'}

```

Bisected it down to:

```
commit 2d4e66bb87aff0b62c67f3edc9792298dbadff07
Author: milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>
Date:   Thu Dec 14 22:38:58 2023 +0000

    Refactor "_html_base" writer.
    
    Auxiliary method `HTMLTranslator.image_size()` to bring
    `HTMLTranslator.visit_image()` to a reasonable size.
    
    Improve/test error reporting when an image file cannot be read.
    
    Sort methods in `HTMLTranslator`.
    
    Small cleanups and optimizations.
    
    git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@9501 929543f6-e4f2-0310-98a6-ba3bd3dd1d04

 docutils/writers/_html_base.py                 | 230 ++++++++++++-------------
 test/test_writers/test_html5_polyglot_misc.py  |   4 +-
 test/test_writers/test_html5_polyglot_parts.py |  72 +++++++-
 3 files changed, 181 insertions(+), 125 deletions(-)
```

I can reproduce with Python 3.10.14, 3.11.9, 3.12.3; Pillow 10.3.0, Pygments 2.17.2.


---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.