-
Notifications
You must be signed in to change notification settings - Fork 1
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
cannot change value of locked binding #6
Comments
I have also tried unlocking the environment during testing a few different ways, but haven't found anything that works:
|
Hi @nbenn , have you had a chance to think about this? I'm also hitting it when I try to mock
|
I'm very sorry for not having gotten back to you earlier! I tried to reproduce your issue (see nbenn/mockthat6) and I pushed a small fix that resolves the issue in that particular instance. Let me know if you're still having troubles and feel free to submit a PR to the mockthat6 repo if this does not yet cover your use-case. Let me know if your problem is solved, so that I can send an update to CRAN. |
Thanks @nbenn - don't worry about the lag! I know attention is a precious resource. I think this fix does the trick. I can now import functions like so #' @importFrom aws.s3 s3write_using
#' @importFrom withr local_envvar in my package code, and then do mockthat::with_mock(
s3write_using=mock_s3,
local_envvar=mock_envvar,
...) in my testing code, and it seems to work under both |
Hi @nbenn - any chance you can release a version to CRAN with this fix? |
Looks like version 0.2.8, released 2022-11-01, includes this fix, so this ticket can be closed. Thanks again! |
I've got a package that I'm testing, and I call
getURL
from theRCurl
package in it. That function is imported, so myNAMESPACE
hasimportFrom(RCurl,getURL)
in it.When I mock that out in my testing, I do this:
This fails with the following error, but only when I run under
devtools::check()
(it succeeds underdevtools::test()
):Is there something I need to do differently for an imported function like this?
I'm using:
Apologies for not creating a proper
reprex
- it will take quite a while to slim down my package code to something isolated, and I'm also not sure how to demonstrate the problem without having a whole package structure.The text was updated successfully, but these errors were encountered: