-
Notifications
You must be signed in to change notification settings - Fork 26
Deprecate signal_stage()
#202
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# deprecation warnings are not displayed again | ||
|
||
Code | ||
wrn | ||
Output | ||
<warning/lifecycle_warning_deprecated> | ||
Warning: | ||
`foo()` was deprecated in lifecycle 1.0.0. | ||
This warning is displayed once per session. | ||
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. | ||
|
||
--- | ||
|
||
Code | ||
wrn | ||
Output | ||
<warning/lifecycle_warning_deprecated> | ||
Warning: | ||
`foo()` was deprecated in lifecycle 1.0.0. | ||
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. | ||
|
||
--- | ||
|
||
Code | ||
wrn | ||
Output | ||
<warning/lifecycle_warning_deprecated> | ||
Warning: | ||
`foo()` was deprecated in lifecycle 1.0.0. | ||
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,24 +57,41 @@ test_that("soft-deprecation warnings are issued when called from child of global | |
}) | ||
|
||
test_that("deprecation warnings are not displayed again", { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test was super broken and wasn't testing what we thought it was. Mostly due to the |
||
local_options(lifecycle_verbosity = NULL) | ||
local_interactive() | ||
on.exit(env_unbind(deprecation_env, c("once-per-session", "unconditional"))) | ||
|
||
wrn <- catch_cnd( | ||
deprecate_warn("1.0.0", "foo()", id = "once-per-session-note"), | ||
classes = "warning" | ||
) | ||
footer <- cnd_footer(wrn) | ||
expect_true(is_character(footer) && any(grepl("once per session", footer))) | ||
# With `"default"` - warning only shown once per session | ||
local_options(lifecycle_verbosity = "default") | ||
|
||
retired <- function() { | ||
deprecate_warn("1.0.0", "foo()", id = "once-per-session") | ||
} | ||
|
||
# First and only time shows "once per session" message | ||
wrn <- catch_cnd(retired(), classes = "lifecycle_warning_deprecated") | ||
expect_s3_class(wrn, "lifecycle_warning_deprecated") | ||
expect_snapshot(wrn) | ||
|
||
# Calling it again gives no warning at all | ||
wrn <- catch_cnd(retired(), classes = "lifecycle_warning_deprecated") | ||
expect_null(wrn) | ||
|
||
# With `"warning"` - warning shows unconditionally | ||
local_options(lifecycle_verbosity = "warning") | ||
|
||
wrn <- catch_cnd(deprecate_warn( | ||
"1.0.0", | ||
"foo()", | ||
id = "once-per-session-no-note" | ||
)) | ||
expect_false(grepl("once per session", conditionMessage(wrn))) | ||
retired <- function() { | ||
deprecate_warn("1.0.0", "foo()", id = "unconditional") | ||
} | ||
|
||
# First time doesn't show "once per session" message because we always warn | ||
wrn <- catch_cnd(retired(), classes = "lifecycle_warning_deprecated") | ||
expect_s3_class(wrn, "lifecycle_warning_deprecated") | ||
expect_snapshot(wrn) | ||
|
||
# Calling it again shows the warning again, again without "once per session" | ||
wrn <- catch_cnd(retired(), classes = "lifecycle_warning_deprecated") | ||
expect_s3_class(wrn, "lifecycle_warning_deprecated") | ||
expect_snapshot(wrn) | ||
}) | ||
|
||
test_that("the topenv of the empty env is not the global env", { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm not sure it's worth deprecating these functions.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided over Zed to go ahead and soft-deprecate them with the goal of having an easy removal in a few years