Merged
Conversation
Member
tomjemmett
commented
Feb 5, 2026
- eliminates any stub calls, favouring local_mocked_bindings
- uses withr::local_seed rather than set.seed
- adds bindings to some base functions so we can mock these in tests
- eliminates any stub calls, favouring local_mocked_bindings - uses withr::local_seed rather than set.seed - adds bindings to some base functions so we can mock these in tests
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors test code to use modern testthat best practices by replacing stub calls with local_mocked_bindings and set.seed with withr::local_seed. The changes ensure automatic cleanup after tests and improve test isolation.
Changes:
- Replaced all
stubcalls withlocal_mocked_bindingsfor better automatic cleanup - Replaced
set.seedwithwithr::local_seedto ensure seed is automatically reset - Added bindings for base R functions (
system.file,file.exists) in R/ZZZ.R to enable mocking
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-utils_server.R | Converted stub calls to local_mocked_bindings for AzureAuth and AzureStor functions |
| tests/testthat/test-utils_data.R | Converted stub call for file.exists to local_mocked_bindings |
| tests/testthat/test-fct_table.R | Replaced set.seed with withr::local_seed |
| tests/testthat/test-fct_plots.R | Replaced set.seed with withr::local_seed |
| tests/testthat/test-app_server.R | Converted mockery::stub call to local_mocked_bindings for bslib function |
| tests/testthat/test-add_external_resources.R | Converted stub call for system.file to local_mocked_bindings |
| R/ZZZ.R | Added NULL bindings for base R functions (system.file, file.exists) to enable mocking |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
matt-dray
approved these changes
Feb 5, 2026
Contributor
matt-dray
left a comment
There was a problem hiding this comment.
Okey-doke, thanks, happy to go with your suggestions.
After merge I'm going to un-release 0.3.4 and re-release with this included.
Member
Author
|
I wouldn't worry too much about re-releasing, these are just minor changes! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.