Skip to content

Commit 6c56208

Browse files
committed
Fix local_edition ambiguity in tests
This appears to cause errors when running tests within some interactive sessions, e.g., from running tests (attaching `testthat`), then `library(tidyverse)` (attaching `readr` and masking `local_edition` even if `testthat` is re-`library`-ied in), then attempting to run tests again.
1 parent dd6ef48 commit 6c56208

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

tests/testthat/test-epix_fill_through_version.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ test_that("epix_fill_through_version mirrors input when it is sufficiently up to
1111
# edition 3, which is based on `waldo::compare` rather than `base::identical`;
1212
# `waldo::compare` in waldo >=0.3.1 appears (as of 0.4.0) to compare R6
1313
# objects by contents rather than address (in a way that is tested but maybe
14-
# not guaranteed via user docs). Use `local_edition` to ensure we use edition
15-
# 3 here.
16-
local_edition(3)
14+
# not guaranteed via user docs). Use `testthat::local_edition` to ensure we
15+
# use testthat edition 3 here (use `testthat::` to prevent ambiguity with
16+
# `readr`).
17+
testthat::local_edition(3)
1718
expect_identical(ea_orig, ea_trivial_fill_na1)
1819
expect_identical(ea_orig, ea_trivial_fill_na2)
1920
expect_identical(ea_orig, ea_trivial_fill_locf)
@@ -30,9 +31,9 @@ test_that("epix_fill_through_version can extend observed versions, gives expecte
3031
ea_fill_na = epix_fill_through_version(ea_orig, later_unobserved_version, "na")
3132
ea_fill_locf = epix_fill_through_version(ea_orig, later_unobserved_version, "locf")
3233

33-
# We use edition 3 features here, passing `ignore_attr` to `waldo::compare`.
34-
# Ensure we are using edition 3:
35-
local_edition(3)
34+
# We use testthat edition 3 features here, passing `ignore_attr` to
35+
# `waldo::compare`. Ensure we are using edition 3:
36+
testthat::local_edition(3)
3637
withCallingHandlers({
3738
expect_identical(ea_fill_na$versions_end, later_unobserved_version)
3839
expect_identical(tibble::as_tibble(ea_fill_na$as_of(first_unobserved_version)),

tests/testthat/test-epix_merge.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ test_that("epix_merge merges and carries forward updates properly", {
5858
)
5959
# We rely on testthat edition 3 expect_identical using waldo, not identical. See
6060
# test-epix_fill_through_version.R comments for details.
61-
local_edition(3)
61+
testthat::local_edition(3)
6262
expect_identical(xy, xy_expected)
6363
})
6464

0 commit comments

Comments
 (0)