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

feat: use OffTargetDetector and ExecutableRunner as ContextManagers #64

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

clintval
Copy link
Member

@clintval clintval commented Oct 4, 2024

Since OffTargetDetector and ExecutableRunner are context managers, it makes sense to type them as such by having them inherit from the abstract manager base class. This PR also fixes an issue where if tests fail, IO resources are not cleaned up since context managers were not being used.

Comment on lines +588 to +597
picked: list[PrimerPair] = pick_top_primer_pairs(
primer_pairs=primer_pairs,
num_primers=len(primer_pairs),
min_difference=min_difference,
params=params,
offtarget_detector=offtarget_detector,
is_dimer_tm_ok=lambda s1, s2: (
dimer_checker.duplex_tm(s1=s1, s2=s2) <= params.max_dimer_tm
),
)
Copy link
Member Author

@clintval clintval Oct 4, 2024

Choose a reason for hiding this comment

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

This test helper is executed many times. Previously, if any of these tests failed, 100s of file handles would be left open on the OS without close.

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.38%. Comparing base (c434b1d) to head (05f716e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #64   +/-   ##
=======================================
  Coverage   97.37%   97.38%           
=======================================
  Files          25       25           
  Lines        1601     1605    +4     
  Branches      302      302           
=======================================
+ Hits         1559     1563    +4     
  Misses         23       23           
  Partials       19       19           

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

Copy link
Member

@tfenne tfenne left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@clintval clintval merged commit 5515d05 into main Oct 4, 2024
6 checks passed
@clintval clintval deleted the chore/context_managers branch October 4, 2024 16:47
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