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

Removed deprecated with_mock() from tests #153

Merged
merged 15 commits into from
Jan 16, 2025

Conversation

alecbuetow
Copy link
Contributor

Note: Files in the R folder were modified to include a binding for requireNamespace, but merely assign the function to itself. This change was necessary to allow requireNamespace to be mocked during testing, as with_mocked_bindings() and local_mocked_bindings() can only modify functions within Dendextend's namespace; see this documentation for more details.

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.40%. Comparing base (5c0b7ab) to head (ba54b4c).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #153   +/-   ##
=======================================
  Coverage   99.40%   99.40%           
=======================================
  Files          50       50           
  Lines        4184     4184           
=======================================
  Hits         4159     4159           
  Misses         25       25           

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

@talgalili
Copy link
Owner

Thanks!
Is this ready for review?

@alecbuetow
Copy link
Contributor Author

Yep! As a heads up I bound requireNamespace to NULL instead of to itself, as suggested by the docs for with_mocked_bindings()

@talgalili
Copy link
Owner

Before I merge,
Can't you use
requireNamespace <- NULL
Inside the tests themselves, and not in the package's files?

@alecbuetow
Copy link
Contributor Author

Unfortunately with_mocked_bindings() requires the base function to be bound as part of the namespace of the package, so only defining it within the test won't work. I tried binding requireNamespace in the tests prior to commit 44e4335 but that was the reason it kept failing the checks. The documentation recommends binding base functions to NULL but I see why that would be avoided if possible

@talgalili
Copy link
Owner

Got it.
Ok

Thanks!

@talgalili talgalili merged commit 26395ea into talgalili:master Jan 16, 2025
17 checks passed
R/circlize.R Show resolved Hide resolved
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