Make is_interactive() react to "rlang_interactive" option#734
Merged
Conversation
Helpful for gargle's pseudo-OOB flow in Google Colab
jennybc
commented
Feb 22, 2023
Comment on lines
+217
to
+219
| is_interactive <- function() { | ||
| getOption("rlang_interactive") %||% interactive() | ||
| } |
Member
Author
There was a problem hiding this comment.
I can't use rlang::is_interactive() because httr does not depend on rlang at this point. And it doesn't seem worth bringing a whole standalone file in for this.
Comment on lines
+114
to
+117
| old <- options() | ||
| on.exit(options(old)) | ||
| options(rlang_interactive = FALSE) | ||
|
|
Member
Author
There was a problem hiding this comment.
This test would previously fail when run with test_active_file(), so I fixed that while I was here.
Comment on lines
+124
to
+126
| old <- options() | ||
| on.exit(options(old)) | ||
| options(rlang_interactive = TRUE) |
Member
Author
There was a problem hiding this comment.
Took the chance to get rid of the with_mock() call, even though httr doesn't use testthat 3e. httr also doesn't use withr.
hadley
approved these changes
Feb 22, 2023
Member
Author
|
Just to record this analysis somewhere: I have not replaced every call to
|
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.
This will allow me to make gargle's pseudo-OOB flow work in Google Colab, which would be really nice.
Relates to r-lib/gargle#237, where I currently have
utils::assignInNamespace("is_interactive", rlang::is_interactive, ns = "httr")in.onLoad(), but I can remove that if this PR gets merged and released. I don't think I could release gargle to CRAN withassignInNamespace().Relates to r-lib/gargle#140