Skip to content

Move shared code to frq_base.py#690

Merged
leehart merged 22 commits intomasterfrom
664-freq-functions
Feb 4, 2025
Merged

Move shared code to frq_base.py#690
leehart merged 22 commits intomasterfrom
664-freq-functions

Conversation

@jonbrenas
Copy link
Copy Markdown
Collaborator

Addresses #664 .

I moved the functions to enable the computation of frequencies and the plotting functions (which required to define a new AnophelesFrequency class). I still want to move the tests of the plotting functions to their own file instead of test_snp_frq.py.

@jonbrenas
Copy link
Copy Markdown
Collaborator Author

The tests for the plotting functions are still only on SNP frequencies. Is that good enough?

@jonbrenas
Copy link
Copy Markdown
Collaborator Author

@alimanfoo, I might have found a solution that works for what I wanted to do (namely, import shared testing functions for plotting frequencies into the various test_*_frq.pys) by telling pytest to ignore them when it reaches their file (it means that the tests now return the number of "passed", "skipped", "failed" tests (as well as warnings). I checked that when the tests are actually run when called in the relevant file, they would show a failure if they failed (i.e., they are not skipped when explicitly called).

@jonbrenas jonbrenas marked this pull request as ready for review January 2, 2025 14:04
Copy link
Copy Markdown
Member

@alimanfoo alimanfoo left a comment

Choose a reason for hiding this comment

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

Hi @jonbrenas, thanks so much. A few comments...

@alimanfoo
Copy link
Copy Markdown
Member

@alimanfoo, I might have found a solution that works for what I wanted to do (namely, import shared testing functions for plotting frequencies into the various test_*_frq.pys) by telling pytest to ignore them when it reaches their file (it means that the tests now return the number of "passed", "skipped", "failed" tests (as well as warnings). I checked that when the tests are actually run when called in the relevant file, they would show a failure if they failed (i.e., they are not skipped when explicitly called).

Thanks @jonbrenas. As suggested in the code review above, it might be even better to name these utility functions like "check_..." instead of "test_..." then no need for skipping.

If the importing of functions between test modules seems to work then I guess we're OK! I still don't understand the mechanics of how pytest imports test modules. But if you've confirmed it works then no objection.

@jonbrenas
Copy link
Copy Markdown
Collaborator Author

Thanks @alimanfoo. This all makes a lot of sense.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 97.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 94.96%. Comparing base (cc1ce67) to head (8c0a432).
Report is 123 commits behind head on master.

Files with missing lines Patch % Lines
malariagen_data/anoph/frq_base.py 96.79% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #690      +/-   ##
==========================================
+ Coverage   94.57%   94.96%   +0.39%     
==========================================
  Files          40       45       +5     
  Lines        4187     4612     +425     
==========================================
+ Hits         3960     4380     +420     
- Misses        227      232       +5     

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

@leehart leehart requested review from alimanfoo and removed request for alimanfoo January 24, 2025 11:06
@leehart leehart self-requested a review January 24, 2025 11:58
Copy link
Copy Markdown
Collaborator

@leehart leehart left a comment

Choose a reason for hiding this comment

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

Thanks @jonbrenas . This looks good to go, unless you know of any further changes required?

@leehart leehart merged commit 6ce9f11 into master Feb 4, 2025
@leehart leehart deleted the 664-freq-functions branch February 4, 2025 14:35
@leehart leehart changed the title Creating a file for the code shared by all _frequencies functions Move shared code to frq_base.py Mar 3, 2025
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