Skip to content

Conversation

kurtmckee
Copy link
Contributor

@kurtmckee kurtmckee commented Aug 20, 2025

docutils 0.22 introduced an RST stylesheet feature that must be able to open files during RST-to-HTML rendering.

The original design of the test_cli_explicit_format test patched pathlib.Path.open() so it would always return the same open file instance...which was always closed on first use. This caused a failure when docutils tried to open minimal.css:

ValueError: I/O operation on closed file.

This change introduces a more complex mocking strategy that documents and meets the current technical requirements.

When combined with #328, the full test suite will now pass.

Note

It may be worthwhile to consider using the pyfakefs plugin, and pytest's capsys, to simplify some of the mocking and patching used in the test suite.

docutils 0.22 introduced an RST stylesheet feature
that must be able to open files during RST-to-HTML rendering.

The original design of the `test_cli_explicit_format` test
patched `pathlib.Path.open()` so it would always return the
same open file instance...which was always closed on first use.
This caused a failure when docutils tried to open `minimal.css`:

```
ValueError: I/O operation on closed file.
```

This change introduces a more complex mocking strategy
that documents and meets the current technical requirements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant