-
Notifications
You must be signed in to change notification settings - Fork 11
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
Double-colon mocking not working at depth #52
Comments
Seems to be a duplicate of #29? |
I should mention: neither of those workarounds are great, because they both require changing the code that's being tested. I'll probably go with the don't-use-double-colon workaround for now, though, because changing the structure would be quite a bit more invasive than that. |
@jimhester hmm, yes, it might be the same bug - somehow when I was debugging this yesterday, I saw #29 and managed to convince myself that's not what was happening, but right now it seems to be the same. The other angle that comes to play here is whether or not the code being tested is in another namespace/package, and yesterday I thought that mattered, but today it seems to be the same bug in either case, would you agree there? |
Yeah, from just looking at the examples I think it looks to be the same issue. |
We now recommend that you use |
Here's my reprex, showing a failed attempt at mocking:
Created on 2021-09-17 by the reprex package (v2.0.1)
If I change to mocking an imported function instead, it works as desired:
Alternatively, if I only need to go 1 level deep, and I remove the
depth=5
argument, it also works as desired:If the
depth=5
argument is included (which theoretically should have no effect here), it fails:The text was updated successfully, but these errors were encountered: