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

Use continue instead of pass & implement tests for vert_coords.py #1049

Merged
merged 23 commits into from
Apr 30, 2024

Conversation

lewisblake
Copy link
Member

@lewisblake lewisblake commented Mar 14, 2024

Change Summary

Fixes pass instead of continue error in vert_cords.py and increases test coverage of vert_coords.py by implementing tests and removing unused code.

Related issue number

NA

Checklist

  • Start with a draft-PR
  • The PR title is a good summary of the changes
  • PR is set to AeroTools and a tentative milestone
  • Documentation reflects the changes where applicable
  • Tests for the changes exist where applicable
  • Tests pass locally
  • Tests pass on CI
  • At least 1 reviewer is selected
  • Make PR ready to review

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.67%. Comparing base (9e569d8) to head (114bf89).
Report is 708 commits behind head on main-dev.

Additional details and impacted files
@@             Coverage Diff              @@
##           main-dev    #1049      +/-   ##
============================================
+ Coverage     78.59%   78.67%   +0.08%     
============================================
  Files           125      126       +1     
  Lines         19964    20069     +105     
============================================
+ Hits          15690    15789      +99     
- Misses         4274     4280       +6     
Flag Coverage Δ
unittests 78.67% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lewisblake lewisblake marked this pull request as ready for review March 14, 2024 08:53
Copy link
Collaborator

@avaldebe avaldebe left a comment

Choose a reason for hiding this comment

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

is this change covered by the test suite?

@lewisblake
Copy link
Member Author

No, it has been specifically excluded from the testing coverage. This is probably not desired anymore.

"pyaerocom/vert_coords.py",

@lewisblake
Copy link
Member Author

lewisblake commented Mar 18, 2024

Will need to write tests for vert_coords.py because we using this code elsewhere now.

First step is add to test coverage.

@lewisblake
Copy link
Member Author

The code coverage indicates we are not testing this module. There is no test_vert_coords either.

@lewisblake lewisblake added this to the m2024-05 milestone Apr 8, 2024
@thorbjoernl thorbjoernl self-assigned this Apr 16, 2024
@thorbjoernl
Copy link
Collaborator

There seem to be a number of functions in vert_coords.py that aren't being used anywhere in the code base. Can these be removed? This seems to apply to:

  • is_supported()
  • pressure2altitude()
  • geopotentialheight2altitude() (Which is also unimplemented)

@thorbjoernl thorbjoernl changed the title Use continue instead of pass in vert_coords.py Use continue instead of pass & implement tests for vert_coords.py Apr 17, 2024
@thorbjoernl thorbjoernl force-pushed the vertcords1047 branch 3 times, most recently from da9f473 to e7aac0f Compare April 25, 2024 09:09
tests/test_vert_coords.py Outdated Show resolved Hide resolved
tests/test_vert_coords.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@avaldebe avaldebe left a comment

Choose a reason for hiding this comment

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

good effort, please work a bit more on the tests

pyaerocom/vert_coords.py Outdated Show resolved Hide resolved
pyaerocom/vert_coords.py Outdated Show resolved Hide resolved
pyaerocom/vert_coords.py Outdated Show resolved Hide resolved
tests/test_vert_coords.py Outdated Show resolved Hide resolved
tests/test_vert_coords.py Show resolved Hide resolved
tests/test_vert_coords.py Outdated Show resolved Hide resolved
tests/test_vert_coords.py Show resolved Hide resolved
@thorbjoernl
Copy link
Collaborator

While fixing the CR issues I discovered that there were a number of references to code I had previously removed remaining in the code. These were not called in the code, and mostly used here which is an elif clause which always raises an exception, and is thus unlikely to be part of the program flow. I've cut out most of that clause, as well as any logic related to the vert_cord.py check_altitude_access() without breaking any tests.

@avaldebe
Copy link
Collaborator

While fixing the CR issues I discovered that there were a number of references to code I had previously removed remaining in the code. These were not called in the code, and mostly used here which is an elif clause which always raises an exception, and is thus unlikely to be part of the program flow. I've cut out most of that clause, as well as any logic related to the vert_cord.py check_altitude_access() without breaking any tests.

I do not understand what are you trying to say hare.
Where the removed, non-implemented methods, used somewhere?
Then, what did you do with the calls?
Did you removed them?

@thorbjoernl
Copy link
Collaborator

It is basically cleaning up left overs from my original cleanup. I had removed some functions, but missed functions which called on the removed functions. This didn't surface because that path is only in the mentioned elif clause. This just removes the remaining dangling references. So in short, yes, I removed them.

@thorbjoernl thorbjoernl reopened this Apr 30, 2024
Copy link
Collaborator

@avaldebe avaldebe left a comment

Choose a reason for hiding this comment

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

🚀 🎆

test.py Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the purpose of this file?
are the methods here the same as the ones on vert_coords?

@avaldebe avaldebe merged commit 7d0b4b8 into main-dev Apr 30, 2024
13 checks passed
@avaldebe avaldebe deleted the vertcords1047 branch April 30, 2024 14:06
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