|
From: Michał G. <mgo...@us...> - 2025-05-19 10:15:27
|
---
**[bugs:#500] Html5WriterPublishPartsTestCase.test_publish skips too much when with_pygments is False**
**Status:** open
**Created:** Mon May 19, 2025 10:15 AM UTC by Michał Górny
**Last Updated:** Mon May 19, 2025 10:15 AM 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 doc...@li... 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. |
|
From: Günter M. <mi...@us...> - 2025-05-19 21:14:35
|
- **status**: open --> open-fixed
- **Comment**:
Fixed in [r10134]. Thank you for the report.
---
**[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 10:15 AM 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 doc...@li... 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. |
|
From: Michał G. <mgo...@us...> - 2025-05-20 00:52:48
|
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 doc...@li... 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. |
|
From: Günter M. <mi...@us...> - 2025-05-20 11:53:57
|
- **status**: open-fixed --> open
- **Comment**:
PIL error outputs seem to be hard to predict. I got absolute paths with
Python 3.9.2 / Pillow 9.1.1 and Python 3.11.2 / Pillow 9.4.0.
It also depends on whether `Image.open()` is passed a `str` or a `Path`.
Could you try the following patch? (It works here with the versions above.)
~~~
diff --git a/docutils/test/test_writers/test_html5_polyglot.py b/docutils/test/test_writers/test_html5_polyglot.py
index f31277a36..b2fc3cc23 100644
--- a/docutils/test/test_writers/test_html5_polyglot.py
+++ b/docutils/test/test_writers/test_html5_polyglot.py
@@ -41,13 +41,11 @@
if PIL:
REQUIRES_PIL = ''
ONLY_LOCAL = 'Cannot get file path corresponding to https://dummy.png.'
- DUMMY_PNG_NOT_FOUND = "[Errno 2] No such file or directory: 'dummy.png'"
- # Pillow reports the absolute path since version 10.3.0 (cf. [bugs: 485])
- # Backported to version 9.1 (or does it depend on the Python version)?
- pil_version = tuple(int(i) for i in PIL.__version__.split('.'))
- if pil_version >= (10, 3) or pil_version[0] == 9 and pil_version[1] >= 1:
- DUMMY_PNG_NOT_FOUND = ("[Errno 2] No such file or directory: '%s'"
- % Path('dummy.png').resolve())
+ # Pillow versions vary in their error output (cf. bugs: #485 and #500)
+ try:
+ PIL.Image.open(Path('dummy.png'))
+ except OSError as err:
+ DUMMY_PNG_NOT_FOUND = str(err)
HEIGHT_ATTR = 'height="32" '
WIDTH_ATTR = 'width="32" '
NO_PIL_SYSTEM_MESSAGE = ''
@@ -90,7 +88,7 @@ def test_publish(self):
**settings_overrides,
}
)
- self.assertEqual(case_expected, parts['body'])
+ self.assertEqual(case_expected, parts[ 'body'])
totest = {} # expected samples contain only the "body" part of the HMTL output
~~~
---
**[bugs:#500] Html5WriterPublishPartsTestCase.test_publish skips too much when with_pygments is False**
**Status:** open
**Created:** Mon May 19, 2025 10:15 AM UTC by Michał Górny
**Last Updated:** Tue May 20, 2025 12:52 AM 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 doc...@li... 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. |
|
From: Michał G. <mgo...@us...> - 2025-05-20 12:24:16
|
I can confirm that the patch makes tests pass for me — and it definitely looks more reliable in the long run. Thanks!
---
**[bugs:#500] Html5WriterPublishPartsTestCase.test_publish skips too much when with_pygments is False**
**Status:** open
**Created:** Mon May 19, 2025 10:15 AM UTC by Michał Górny
**Last Updated:** Tue May 20, 2025 11:53 AM 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 doc...@li... 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. |
|
From: Günter M. <mi...@us...> - 2025-05-20 15:09:58
|
- **status**: open --> open-fixed
- **Comment**:
Thanks for the fast feedback. The patch is now in the repository [r10135].
---
**[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:** Tue May 20, 2025 12:24 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 doc...@li... 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. |
|
From: Günter M. <mi...@us...> - 2025-07-30 08:54:13
|
- **status**: open-fixed --> closed-fixed
- **Comment**:
The bug is fixed in Docutils 0.22 released 2025-07-29.
Thank you for reporting.
---
**[bugs:#500] Html5WriterPublishPartsTestCase.test_publish skips too much when with_pygments is False**
**Status:** closed-fixed
**Created:** Mon May 19, 2025 10:15 AM UTC by Michał Górny
**Last Updated:** Tue May 20, 2025 03:09 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 doc...@li... 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. |