Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Oct 25, 2024
1 parent 269fde4 commit 54a0661
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sphinx/directives/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def parse_options(self) -> None:
def read_file(
self, filename: str | os.PathLike[str], location: tuple[str, int] | None = None
) -> list[str]:
filename = _StrPath(filename)
try:
with open(filename, encoding=self.encoding, errors='strict') as f:
text = f.read()
Expand All @@ -227,11 +228,11 @@ def read_file(

return text.splitlines(True)
except OSError as exc:
msg = __('Include file %r not found or reading it failed') % filename
msg = __("Include file '%s' not found or reading it failed") % filename
raise OSError(msg) from exc
except UnicodeError as exc:
msg = __(
'Encoding %r used for reading included file %r seems to '
"Encoding %r used for reading included file '%s' seems to "
'be wrong, try giving an :encoding: option'
) % (self.encoding, filename)
raise UnicodeError(msg) from exc
Expand Down

0 comments on commit 54a0661

Please sign in to comment.