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

Rose env cat fix #2578

Merged
merged 2 commits into from
Apr 11, 2022
Merged

Rose env cat fix #2578

merged 2 commits into from
Apr 11, 2022

Conversation

wxtim
Copy link
Contributor

@wxtim wxtim commented Apr 9, 2022

Fixes two bugs found by tester.

Missing input file produces traceback

Handle this more elegantly.

Write to output file doesn't work

Trying to write a string to a file handle opened in bytes mode.

Testing/Refactor

The first commit is a refactor without functional changes to allow for testing, and tests for the issues described. Checking f812619 out should cause two of the three tests (pytest metomi/rose/tests/test_env_cat.py -vv) to fail.

The second commit 1abaca8 fixes both problems.

Additional check

By inserting print statements into the code I was able to ascertain that there coverage is now ~100%, though this is only a measure of quantity, not quality.

Tagged @oliver-sanders as a single Python test :. this is a smallish change with @dpmatthews as a functional tester.

@wxtim wxtim self-assigned this Apr 9, 2022
@wxtim wxtim force-pushed the rose_env_cat_fix branch from ff210d0 to 1abaca8 Compare April 9, 2022 20:05
@wxtim wxtim added the bug label Apr 9, 2022
@wxtim wxtim added this to the 2.0rc3 milestone Apr 9, 2022
@wxtim wxtim requested review from MetRonnie and removed request for dpmatthews April 11, 2022 10:09
@MetRonnie
Copy link
Contributor

Poking tests

@MetRonnie MetRonnie closed this Apr 11, 2022
@MetRonnie MetRonnie reopened this Apr 11, 2022
@oliver-sanders
Copy link
Member

(looks good, waiting for tests...)

Comment on lines +62 to +63
in_handle.close()
out_handle.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

These should probably come in a try... finally block, or use with open() instead, but understandable to leave as is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was attempting to not change too much. Agree in principle but was going for a minimal change.

@oliver-sanders oliver-sanders merged commit 1d34b4e into metomi:master Apr 11, 2022
@wxtim wxtim deleted the rose_env_cat_fix branch April 11, 2022 16:11
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.

3 participants