Skip to content

Make _LoggingTee compatible with TextIO#1151

Merged
larsoner merged 4 commits intosphinx-gallery:masterfrom
o-laurent:master
Jul 20, 2023
Merged

Make _LoggingTee compatible with TextIO#1151
larsoner merged 4 commits intosphinx-gallery:masterfrom
o-laurent:master

Conversation

@o-laurent
Copy link
Copy Markdown
Contributor

@o-laurent o-laurent commented Jul 19, 2023

Closes #1150.

Following up on the discussion in issue #1150, I'd like to propose this PR to improve the compatibility between _LoggingTee and TextIO. It also includes some tests to keep the coverage complete.

Judging from the previous comments, the non-compatibility was already an issue for other packages (e.g. seaborn). In this PR, the classic attributes of TextIOBase and of IOBase (inherited) are all implemented.

This should prevent further issues on the compatibility between the expected stdout and _LoggingTee. I am, of course, open to reverting to adding only the "encoding" attribute if you find it safer/more appropriate. However, this should not be breaking since I am only adding missing attributes and refactoring previous modifications.

(Sorry for the blank lines issue!)

@larsoner
Copy link
Copy Markdown
Contributor

Looks pretty straightforward, complete, and clean -- thanks @o-laurent !

@larsoner larsoner merged commit 749a567 into sphinx-gallery:master Jul 20, 2023
@larsoner larsoner added the bug label Jul 20, 2023
@o-laurent
Copy link
Copy Markdown
Contributor Author

Thanks for your help and for maintaining the library!

assert tee.writable()


def test_fileno(monkeypatch, log_collector_wrap):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's just this useless argument in the test... Sorry!

clrpackages referenced this pull request in clearlinux-pkgs/pypi-sphinx_gallery Aug 22, 2023
… to version 0.14.0

v0.14.0
-------

**Implemented enhancements:**

-  MAINT Update backreferences docs and add tests `#1154 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1154>`__ (`lucyleeow <https://github.com/lucyleeow>`__)
-  Remove extra spaces in reported running time `#1147 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1147>`__ (`stefanv <https://github.com/stefanv>`__)

**Fixed bugs:**

-  MAINT: Fix for Sphinx 7.2 `#1176 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1176>`__ (`larsoner <https://github.com/larsoner>`__)
-  updated mpl gui warning catcher to new error message `#1160 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1160>`__ (`story645 <https://github.com/story645>`__)
-  Ensure consistent encoding for md5sum generation `#1159 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1159>`__ (`sdhiscocks <https://github.com/sdhiscocks>`__)
-  Maint: Fix ``app.builder.outdir`` as Sphinx now using pathlib `#1155 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1155>`__ (`lucyleeow <https://github.com/lucyleeow>`__)
-  Make \_LoggingTee compatible with TextIO `#1151 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1151>`__ (`o-laurent <https://github.com/o-laurent>`__)

(NEWS truncated at 15 lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an "encoding" attribute to _LoggingTee?

2 participants