Skip to content
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

Cannibalize coala-utils ContextManagers #59

Open
jayvdb opened this issue Aug 25, 2019 · 5 comments
Open

Cannibalize coala-utils ContextManagers #59

jayvdb opened this issue Aug 25, 2019 · 5 comments
Labels
enhancement New feature or request investigate Need to figure this out
Milestone

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Aug 25, 2019

There are some useful bits of coala-utils ContextManagers which may be desirable features here, especially simulate_console_inputs which is extensively used in https://github.com/coala/coala/ testsuite.

Most of the concepts in coala-utils ContextManagers are likely already pending issues here, or can be achieved using the existing functionality. I envisage this issue here is mostly to map coala-utils to stdio-mgr, discuss and track progress.

Created https://gitlab.com/coala/coala-utils/issues/88 for the other side, once most of the necessary enhancements are done here. There is no need to replicate exactly the same functionality, or do it all in one release. coala would contain to use its own wrapper, but it would become a thin layer to stdio-mgr , and possibly (lightly) deprecating some bits where the coala-utils tool has no benefits over the stdio-mgr replacement.

@bskinn
Copy link
Owner

bskinn commented Aug 25, 2019

Mm, simulate_console_inputs definitely has a much more attractive API than stdio-mgr's current init_text. Seems like that could be mimicked in stdio-mgr by just a '\n'.join() on any initialization argument that's a non-str iterable.

For clarity, maybe better to create a new kwarg for it, though?

@bskinn bskinn added enhancement New feature or request investigate Need to figure this out labels Aug 25, 2019
@jayvdb
Copy link
Contributor Author

jayvdb commented Aug 26, 2019

#62 is the first step for a stdin-only-capture.

I did a POC of revised coala-utils & coala, based on top of #64, code at https://gitlab.com/jayvdb/coala-utils/blob/a8212112f5a6dd214422077cdbe1d0447b1291db/coala_utils/ContextManagers.py#L151 which shows the extra features in stdio-mgr needed to have a comparable feature set.

The two usages of last_input (ignoring ContextManagersTest which is a copy of the same in coala-utils, I hope) are worth considering adding here.

https://github.com/coala/coala/blob/6a24dac547e5a6936ccd43068f2fff5753744d7b/tests/settings/SectionFillingTest.py#L52 is asserting that the read buffer was not used, which is easy to achieve a different way.

https://github.com/coala/coala/blob/3eaae8875055d5340b707adaa53c289dd6b96725/tests/output/ConsoleInteractionTest.py#L219 is asserting that the buffer is fully used, again easy to implement a different way.

I had to disable pytest capturing all the way, so something is amiss somewhere, probably in #64 , and even with that the coala test log is full of errors so more is needed.

@bskinn bskinn added this to the v2.0 milestone Sep 4, 2019
@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 6, 2019

I had to disable pytest capturing all the way, so something is amiss somewhere, probably in #64 , and even with that the coala test log is full of errors so more is needed.

This has been fixed with a tweak to #64 and a fix in coala's test logic to workaround #73

The next bit is #74 , and/or the more advanced version #75

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 7, 2019

Offtopic, another set of similar functions at https://github.com/Erotemic/ubelt/blob/master/ubelt/util_stream.py .

We might want to document prior art in the README, or in the docs.

@bskinn
Copy link
Owner

bskinn commented Sep 7, 2019

We might want to document prior art in the README, or in the docs.

New issue to curate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request investigate Need to figure this out
Projects
None yet
Development

No branches or pull requests

2 participants