-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use base TextIOWrapper for stdout and stderr #26
Conversation
Codecov Report
@@ Coverage Diff @@
## master #26 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 52 76 +24
=====================================
+ Hits 52 76 +24
Continue to review full report at Codecov.
|
With this I was able to get the panflute stdio tested. https://travis-ci.org/jayvdb/panflute/builds/564574216 I've also included the encoded bytestream stdin patch, and tried to ensure that all handles are closed even if there is an exception while leaving the context manager. Let me know if there is a better way to write that - it is a bit messy. I think I can write a Whereas with stdin I tried to stick very close to the real stdin, here I havent tried as hard, as these use a random access buffer. IMO this looser implementation is sufficient for 95% of users - the other 5% probably need a specifically crafted solution anyway, and wont use a helper like this package, or they'll come here and provide a better solution. |
Raw binary stdio removed from this PR, and the rest cleaned up. Looking forward to fixing any of my laziness that your keen eyes spot. |
flake8 is now in CI -- please rebase/merge atop |
31396ea
to
8bc3fa0
Compare
This was rebased. |
<nod>, sorry, didn't have a chance to get to it today. Hopefully no later than end-of-day Friday US Eastern. |
34cd7b8
to
951002c
Compare
I didnt get time to think about encodings. I think this is mergable without customisable encodings, and #33 provides a way to change the encodings without exposing lots of params in the constructor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the side-streamed comments, after a few minor documentation/typo fixes, and perhaps some decisions on the public API, I think I'm good to merge this.
Should note, I ran a local test of your output-handles
branch in my project that uses stdio-mgr
most heavily, and it worked smoothly, on both Debian and Windows. So, 👍.
Can't say it enough... again, thank you very much for putting so much work into these improvements.
I think I got all the docs fixed, but there are definitely bits where the internals could be explained better. I prefer to keep RandomTextIO public with Teestdin already public. Its constructor takes no args at the moment, and I believe that any future args will have defaults, so there shouldnt be breaking changes in the immediate future. In the event it becomes useful to other people, but needs to change, we could always use a new class for the internals and deprecate the old one until it can be removed in a major release. |
Would you rather buff the docs as part of this PR, or get this merged and work on them subsequently?
Good point. This probably does argue in favor of just leaving them public. One advantage of the stub superclass I mentioned in the in situ comment, though, is that then users wouldn't have to care as much which specific class they should be |
I'll do another push in a few hours based on discussion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another doc change
Should the stream created from And then, replicate the logic of the |
Still getting my head around this. First step was working out if it was a regression. If i.getvalue() is not going to work after i.close(), then the I am not convinced of the need to have the i.getvalue() work after |
Agreed. With testing being the main target application, the tester should have sufficient control over what's fed into |
I think this PR is ready to merge, after a final rebase onto That will let us start with a clean issue/PR for evaluating docs/docstrings, and the sufficiency of the test suite as it sits. I plan to run We'll also want to decide on the public API. Probably best to run that discussion in a new issue: #42 created. |
I think I've got most of the changes requested, and added some more tests and improved the names/docs of them, but not covering items which have been deferred to other issues. Happy to do more fixups if you see something nasty. Otherwise I'll do any fixups after merge, and work on bytes/encoding. |
Nope, I'm good to merge this as-is, and let further work move along with this as the baseline. There may be some stuff to find and fix, but that can happen as it comes up. |
Follow on from #25 solving #24