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

stop_mocking() should untrace all functions (closes #66, #78) #79

Merged
merged 4 commits into from Jan 24, 2023
Merged

Conversation

kforner
Copy link
Contributor

@kforner kforner commented Jan 19, 2023

fixed stop_mocking() that did not untrace all functionstly called safe_untrace. Added corresponding tests. Should fix issue #78 and #66.

…tly called safe_untrace. Added corresponding tests. Should fix issue #78 and #66.
Copy link
Owner

@nealrichardson nealrichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! A few suggestions.

tests/testthat/test-mock-api.R Outdated Show resolved Hide resolved
Comment on lines 220 to 221
for (verb in c("GET", "PUT", "POST", "PATCH", "DELETE", "VERB", "RETRY")) {
fun <- getFromNamespace(verb, 'httr')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that we don't have to use ::: to get them:

Suggested change
for (verb in c("GET", "PUT", "POST", "PATCH", "DELETE", "VERB", "RETRY")) {
fun <- getFromNamespace(verb, 'httr')
for (fun_name in c("GET", "PUT", "POST", "PATCH", "DELETE", "VERB", "RETRY", "body_config", "request_perform")) {
fun <- getFromNamespace(fun_name, "httr")

R/trace.R Outdated Show resolved Hide resolved
Copy link
Owner

@nealrichardson nealrichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor suggestion but otherwise LGTM, thank you!

tests/testthat/test-trace.R Outdated Show resolved Hide resolved
@nealrichardson nealrichardson changed the title fixed stop_mocking() that did not untrace all functions stop_mocking() should untrace all functions (closes #66, #78) Jan 24, 2023
@nealrichardson nealrichardson merged commit 6ff9c25 into nealrichardson:master Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants