Set .__DEVTOOLS__ marker so testthat::with_mocked_bindings() works with loadfast#12
Merged
Merged
Conversation
…th loadfast Agent-Logs-Url: https://github.com/finccam/loadfast/sessions/8e755081-78be-4f0d-a46f-bf749eb3bffb Co-authored-by: ak-finccam <266784444+ak-finccam@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Investigate cannot use
Set Apr 14, 2026
testthat::with_mocked_bindings() issue.__DEVTOOLS__ marker so testthat::with_mocked_bindings() works with loadfast
Contributor
|
@felix-andreas-finccam Bisher hat |
ak-finccam
approved these changes
Apr 14, 2026
felix-andreas-finccam
approved these changes
Apr 14, 2026
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.
testthat::with_mocked_bindings()auto-detects the active dev package viapkgload::dev_meta(), which looks for a.__DEVTOOLS__environment in the namespace.loadfastwasn't setting this marker, causing the error "No packages loaded with pkgload".Changes
R/loadfast.R: Addns_env[[".__DEVTOOLS__"]] <- new.env(parent = ns_env)during full load namespace setup — mirrors whatpkgload::create_dev_meta()does. The marker persists through incremental reloads since the namespace env is reused.test_loadfast.R: Three new Stage 1 checks —.__DEVTOOLS__is set,pkgload::dev_meta()returns non-NULL, andwith_mocked_bindings()works both with and without explicit.package.After this change: