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

Fix/stderr #276

Merged
merged 5 commits into from
Sep 23, 2022
Merged

Fix/stderr #276

merged 5 commits into from
Sep 23, 2022

Conversation

itstargetconfirmed
Copy link
Contributor

Hi @aguschin,

I've completed the pull request for #265.

I've implemented a similar fix for MLEM and further details can be found here: iterative/mlem#410

I've completed the following updates:

  1. Implemented a context manager stderr_echo to print to stderr.
  2. Implemented the printing of Exception and GTOException to stderr as opposed to stdout using the stderr_echo context manager.
  3. Updated conftest.py with a Runner class similar to the MLEM project. So that CliRunner instances will be created with standard parameters such as mixed_stderr=False. With this implementation, we will guarantee that the result object will have stderr and stdout properties.
  4. Implemented a Runner pytest fixture, similar to the MLEM project, however, no tests are using it currently. I've added it for future use cases.
  5. Implemented 2 tests that ensure Exception and GTOException are printed to stderr.
  6. Implemented 2 helper functions _check_output_contains(output: str, search_value: str) -> bool: and _check_output_exact_match(output: str, search_value: str) -> bool.
  7. The functions in item 6 are used to determine how _check_successful_cmd and _check_failing_cmd should compare stderr and stdout with their expected output.
  8. The functions in item 6 are needed because in the current implementation, streams are exacted matched with their expected outputs, however, when printing to stderr the gto application adds the colour red to the output, which prevents exact match. _check_output_contains allows us to match a substring, correcting the issue.

@codecov-commenter
Copy link

codecov-commenter commented Sep 23, 2022

Codecov Report

Base: 82.79% // Head: 83.56% // Increases project coverage by +0.76% 🎉

Coverage data is based on head (b1c68d5) compared to base (24c165a).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
+ Coverage   82.79%   83.56%   +0.76%     
==========================================
  Files          17       15       -2     
  Lines        1953     1892      -61     
==========================================
- Hits         1617     1581      -36     
+ Misses        336      311      -25     
Impacted Files Coverage Δ
gto/cli.py 72.75% <100.00%> (+2.32%) ⬆️
gto/ui.py 85.00% <100.00%> (+1.36%) ⬆️
gto/utils.py
gto/__init__.py
gto/api.py 91.40% <0.00%> (+0.06%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@aguschin aguschin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks a lot @itstargetconfirmed!

@aguschin aguschin merged commit c656bcd into iterative:main Sep 23, 2022
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.

3 participants