[docutils:bugs] Re: #500 Html5WriterPublishPartsTestCase.test_publish skips too much when with_pygments is False

Michał Górny via Docutils-develop <[email protected]> Tue, 20 May 2025 00:52:48 -0000
Newsgroups gmane.text.docutils.devel
Message-ID </p/docutils/bugs/500/0cbe2d7bcdb7f7603281a1090ea1a14cb56d8b81.bugs@docutils.p.sourceforge.net>
Thanks. However, the original issue that I tried to debug is: for me Pillow 11.2.1 produces relative paths, i.e. now I'm seeing:

```
======================================================================
FAIL: test_publish (test_writers.test_html5_polyglot.Html5WriterPublishPartsTestCase.test_publish) (id="totest['system_messages-PIL'][0]")
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/docutils/docutils/test/test_writers/test_html5_polyglot.py", line 93, in test_publish
    self.assertEqual(case_expected, parts['body'])
AssertionError: '<img[305 chars]y: \'/tmp/docutils/docutils/test/dummy.png\'</[280 chars]e>\n' != '<img[305 chars]y: \'dummy.png\'</p>\n</aside>\n<aside class="[252 chars]e>\n'
  <img alt="dummy.png" src="dummy.png" />
  <aside class="system-message">
  <p class="system-message-title">System Message: WARNING/2 (<span class="docutils literal"><string></span>, line 1)</p>
  <p>Cannot scale image!
    Could not get size from "dummy.png":
-   [Errno 2] No such file or directory: '/tmp/docutils/docutils/test/dummy.png'</p>
?                                         ----------------------------
+   [Errno 2] No such file or directory: 'dummy.png'</p>
  </aside>
  <aside class="system-message">
  <p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal"><string></span>, line 1)</p>
  <p>Cannot embed image "dummy.png":
    [Errno 2] No such file or directory: 'dummy.png'</p>
  </aside>


----------------------------------------------------------------------
Ran 2285 tests in 4.599s

FAILED (failures=1, skipped=4)
```

Do you want me to open a separate bug for that? I can reproduce with Python 3.11.12, 3.12.10, 3.13.3.


---

**[bugs:#500] Html5WriterPublishPartsTestCase.test_publish skips too much when with_pygments is False**

**Status:** open-fixed
**Created:** Mon May 19, 2025 10:15 AM UTC by Michał Górny
**Last Updated:** Mon May 19, 2025 09:14 PM UTC
**Owner:** nobody


While debugging something else, I've noticed that the `Html5WriterPublishPartsTestCase.test_publish()` case contains the following bit:

```
        for name, (settings_overrides, cases) in totest.items():
            if name == 'syntax_highlight' and not with_pygments:
                self.skipTest('syntax highlight requires pygments')
```

This means that if `with_pygments` is `False`, all the remaining cases from `totest` are skipped. If I replace it with:

```
        for name, (settings_overrides, cases) in totest.items():
            if name == 'syntax_highlight' and not with_pygments:
                continue
```

I see some test regressions too.


---

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.