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 iterate_messages() generator raising StopIteration #60

Merged
merged 3 commits into from
Mar 30, 2020

Conversation

pnuu
Copy link
Member

@pnuu pnuu commented Mar 30, 2020

This PR fixes iterate_messages() what was raising StopIteration when it should just return.

Also adds an unit test for this function, and fixes a flake8 complaint about invalid usage of assert:

trollmoves/tests/test_client.py:86:9: B011 Do not call assert False since python -O removes these calls. Instead callers should raise AssertionError().

@pnuu pnuu added the bug label Mar 30, 2020
@pnuu pnuu requested a review from mraspaud March 30, 2020 09:05
@pnuu pnuu self-assigned this Mar 30, 2020
@ghost
Copy link

ghost commented Mar 30, 2020

Congratulations 🎉. DeepCode analyzed your code in 1.459 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

👉 View analysis in DeepCode’s Dashboard

@codecov
Copy link

codecov bot commented Mar 30, 2020

Codecov Report

Merging #60 into master will increase coverage by 0.16%.
The diff coverage is 90.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #60      +/-   ##
==========================================
+ Coverage   65.09%   65.26%   +0.16%     
==========================================
  Files          14       14              
  Lines        2630     2637       +7     
==========================================
+ Hits         1712     1721       +9     
+ Misses        918      916       -2     
Impacted Files Coverage Δ
trollmoves/tests/test_client.py 99.75% <88.88%> (+<0.01%) ⬆️
trollmoves/client.py 67.27% <100.00%> (+0.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8434db2...e6626c5. Read the comment docs.

@mraspaud
Copy link
Member

For the record, this is new behavious since python 3.7:

Changed in version 3.7: Enable PEP 479 for all code by default: a StopIteration error raised in a generator is transformed into a RuntimeError.

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM

@pnuu pnuu merged commit f22f964 into pytroll:master Mar 30, 2020
@pnuu pnuu deleted the bugfix-iterate_messages branch March 30, 2020 09:10
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.

2 participants