From ef5767600d4eec045735e420e496432ff88bc8bd Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 23 Jul 2026 21:24:26 +0000 Subject: [PATCH 1/8] use attach.required=FALSE to solve "ggplot not found" error --- inst/tests/other.Rraw | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inst/tests/other.Rraw b/inst/tests/other.Rraw index 4b8685a60..9a7725a97 100644 --- a/inst/tests/other.Rraw +++ b/inst/tests/other.Rraw @@ -26,8 +26,10 @@ INT = data.table:::INT if (anyDuplicated(pkgs)) stop("Packages defined to be loaded for integration tests in 'inst/tests/other.Rraw' contains duplicates.") +# attach at the end for #5101; +# attach.required=FALSE for Depends resolution order (see https://stat.ethz.ch/pipermail/r-devel/2026-July/084630.html) f = function(pkg) suppressWarnings(suppressMessages(isTRUE( - library(pkg, character.only=TRUE, logical.return=TRUE, warn.conflicts=FALSE, pos="package:base") # attach at the end for #5101 + library(pkg, character.only=TRUE, logical.return=TRUE, warn.conflicts=FALSE, pos="package:base", attach.required=FALSE) ))) loaded = sapply(pkgs, f) if (!all(loaded)) { From 2800a162b939a57232a6416b13dac3a03f6ea8a3 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 23 Jul 2026 22:04:37 +0000 Subject: [PATCH 2/8] Fix ggplot2 tests after further implementation updates --- inst/tests/other.Rraw | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/inst/tests/other.Rraw b/inst/tests/other.Rraw index 9a7725a97..33869ae43 100644 --- a/inst/tests/other.Rraw +++ b/inst/tests/other.Rraw @@ -58,13 +58,12 @@ if (all(c("package:reshape", "package:reshape2") %in% search())) { if (loaded[["ggplot2"]]) { DT = data.table( a=1:5, b=11:50, d=c("A","B","C","D"), f=1:5, grp=1:5 ) - test(1.1, names(print(ggplot(DT,aes(b,f))+geom_point()))[c(1,3)], c("data","scales")) # update as described in #3047 - test(1.2, DT[,print(ggplot(.SD,aes(b,f))+geom_point()),by=list(grp%%2L)],data.table(grp=integer())) # %%2 to reduce time needed for ggplot2 to plot + print_without_error = \(x) !inherits(tryCatch(print(x), error=identity), "error") + test(1.1, print_without_error(ggplot(DT, aes(b,f)) + geom_point())) # update as described in #3047 + test(1.2, DT[, print_without_error(ggplot(.SD, aes(b,f)) + geom_point()), by=list(grp %% 2L)][, all(V1)]) # %%2 to reduce time needed for ggplot2 to plot if (loaded[["hexbin"]]) { # Test reported by C Neff on 11 Oct 2011 - # TODO(r-lib/gtable#94): don't suppressWarnings() here. - x <- suppressWarnings(print(ggplot(DT) + geom_hex(aes(b, f)) + facet_wrap(~grp))) - test(1.3, names(x)[c(1L, 3L)], c("data", "scales")) + test(1.3, print_without_error(ggplot(DT) + geom_hex(aes(b, f)) + facet_wrap(~grp))) } # Test plotting ITime with ggplot2 which seems to require an as.data.frame method for ITime, #1713 datetimes = c("2011 NOV18 09:29:16", "2011 NOV18 10:42:40", "2011 NOV18 23:47:12", @@ -76,8 +75,12 @@ if (loaded[["ggplot2"]]) { # test(1.4, print(DT[,qplot(idate,itime)])$ranges, # message="Don't know how to automatically pick scale for object of type ITime. Defaulting to continuous") - test(1.5, print(DT[,qplot(idate,as.POSIXct(itime,tzone=""))])$ranges, print(qplot(idate,as.POSIXct(itime,tzone=""),data=DT))$ranges) - try(graphics.off(),silent=TRUE) + # qplot() soon to be deleted, unclear how to adapt the test meaningfully after that... + invisible(try(qplot(), silent=TRUE)) # force deprecation warning + test(1.5, all.equal( + print(DT[, qplot(idate, as.POSIXct(itime, tzone=""))]), + print(qplot(idate, as.POSIXct(itime, tzone=""), data=DT)))) + try(graphics.off(), silent=TRUE) } if (loaded[["plyr"]]) { From 5d4d62adfac4bd3979ae149ab51e66c72b753c49 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 23 Jul 2026 22:05:00 +0000 Subject: [PATCH 3/8] Fix cedta() handling of example() --- R/cedta.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/cedta.R b/R/cedta.R index 11e365495..f25a8d23c 100644 --- a/R/cedta.R +++ b/R/cedta.R @@ -64,7 +64,7 @@ cedta.pkgEvalsUserCode = c("gWidgetsWWW","statET","FastRWeb","slidify","rmarkdow if (exists("debugger.look", parent.frame(n+1L))) return(TRUE) # nocov # 'example' for #2972 - if (length(sc) >= 8L && sc[[length(sc) - 7L]] %iscall% 'example') return(TRUE) # nocov + if (length(sc) >= 9L && sc[[length(sc) - 8L]] %iscall% 'example') return(TRUE) # nocov } if (nsname == "base") { From 28a5070fb3a06fb838146904d44d54ab7591988e Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 23 Jul 2026 22:07:51 +0000 Subject: [PATCH 4/8] dont use native lambda (yet) --- inst/tests/other.Rraw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/tests/other.Rraw b/inst/tests/other.Rraw index 33869ae43..942cedfc2 100644 --- a/inst/tests/other.Rraw +++ b/inst/tests/other.Rraw @@ -58,7 +58,7 @@ if (all(c("package:reshape", "package:reshape2") %in% search())) { if (loaded[["ggplot2"]]) { DT = data.table( a=1:5, b=11:50, d=c("A","B","C","D"), f=1:5, grp=1:5 ) - print_without_error = \(x) !inherits(tryCatch(print(x), error=identity), "error") + print_without_error = function(x) !inherits(tryCatch(print(x), error=identity), "error") test(1.1, print_without_error(ggplot(DT, aes(b,f)) + geom_point())) # update as described in #3047 test(1.2, DT[, print_without_error(ggplot(.SD, aes(b,f)) + geom_point()), by=list(grp %% 2L)][, all(V1)]) # %%2 to reduce time needed for ggplot2 to plot if (loaded[["hexbin"]]) { From 58ce9c4c1766fb0688854cf4258a348b253d7496 Mon Sep 17 00:00:00 2001 From: chiricom Date: Thu, 23 Jul 2026 23:15:13 +0000 Subject: [PATCH 5/8] attach.required not yet available in 3.5.0 --- inst/tests/other.Rraw | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/inst/tests/other.Rraw b/inst/tests/other.Rraw index 942cedfc2..abae0b367 100644 --- a/inst/tests/other.Rraw +++ b/inst/tests/other.Rraw @@ -1,9 +1,9 @@ -pkgs = c("DBI", "RSQLite", "bit64", "caret", "dplyr", "gdata", "ggplot2", "hexbin", "knitr", "nanotime", "nlme", "parallel", "plyr", "R.utils", "sf", "vctrs", "xts", "yaml", "zoo") +pkgs = c("DBI", "RSQLite", "bit64", "ggplot2", "caret", "dplyr", "gdata", "hexbin", "knitr", "nanotime", "nlme", "parallel", "plyr", "R.utils", "sf", "vctrs", "zoo", "xts", "yaml") # First expression of this file must be as above: .gitlab-ci.yml uses parse(,n=1L) to read one expression from this file and installs pkgs. # So that these dependencies of other.Rraw are maintained in a single place. # TEST_DATA_TABLE_WITH_OTHER_PACKAGES is off by default so this other.Rraw doesn't run on CRAN. It is run by GLCI, locally in dev, and by # users running test.data.table("other.Rraw"). -# zoo needs to be before xts for #5101 otherwise xts's dependency zoo gets attached at position 2 if xts is loaded first +# TODO(R>=3.6.0): use attach.required=FALSE to let us keep pkgs= in alphabetical order (https://stat.ethz.ch/pipermail/r-devel/2026-July/084630.html) # Optional Suggest-ed package tests moved from tests.Rraw to here in #5516. Retaining their comments: # "xts", # we have xts methods in R/xts.R @@ -26,10 +26,8 @@ INT = data.table:::INT if (anyDuplicated(pkgs)) stop("Packages defined to be loaded for integration tests in 'inst/tests/other.Rraw' contains duplicates.") -# attach at the end for #5101; -# attach.required=FALSE for Depends resolution order (see https://stat.ethz.ch/pipermail/r-devel/2026-July/084630.html) f = function(pkg) suppressWarnings(suppressMessages(isTRUE( - library(pkg, character.only=TRUE, logical.return=TRUE, warn.conflicts=FALSE, pos="package:base", attach.required=FALSE) + library(pkg, character.only=TRUE, logical.return=TRUE, warn.conflicts=FALSE, pos="package:base") # attach at the end for #5101 ))) loaded = sapply(pkgs, f) if (!all(loaded)) { From 495720f27309f367d5658eccf5189d78412a8329 Mon Sep 17 00:00:00 2001 From: chiricom Date: Fri, 24 Jul 2026 14:16:00 +0000 Subject: [PATCH 6/8] use explicit integer to avoid long double requirement --- inst/tests/other.Rraw | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/inst/tests/other.Rraw b/inst/tests/other.Rraw index abae0b367..c6fa09b61 100644 --- a/inst/tests/other.Rraw +++ b/inst/tests/other.Rraw @@ -169,10 +169,11 @@ if (loaded[["nlme"]]) { if (loaded[["bit64"]]) { # these don't pass UBSAN/USAN because of the overflow, so just here in other.Rraw - test(9.1, as.character((as.integer64(2^62)-1)*2+1), "9223372036854775807") - test(9.2, as.character((as.integer64(2^62)-1)*2+2), NA_character_, warning="integer64 overflow") - test(9.3, as.character(-(as.integer64(2^62)-1)*2-1), "-9223372036854775807") - test(9.4, as.character(-(as.integer64(2^62)-1)*2-2), NA_character_, warning="integer64.*flow") + # Use 'L' to avoid integer64-double math when 'long double' is unavailable. + test(9.1, as.character((as.integer64(2^62)-1L)*2L+1L), "9223372036854775807") + test(9.2, as.character((as.integer64(2^62)-1L)*2L+2L), NA_character_, warning="integer64 overflow") + test(9.3, as.character(-(as.integer64(2^62)-1L)*2L-1L), "-9223372036854775807") + test(9.4, as.character(-(as.integer64(2^62)-1L)*2L-2L), NA_character_, warning="integer64.*flow") } if (loaded[["gdata"]]) { From 0379354ce08636706a690b0e2f58a5e7cd637dd2 Mon Sep 17 00:00:00 2001 From: chiricom Date: Fri, 24 Jul 2026 16:15:43 +0000 Subject: [PATCH 7/8] tryCatch(), not try(), for ignoring warning --- inst/tests/other.Rraw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/tests/other.Rraw b/inst/tests/other.Rraw index c6fa09b61..339577d76 100644 --- a/inst/tests/other.Rraw +++ b/inst/tests/other.Rraw @@ -74,7 +74,7 @@ if (loaded[["ggplot2"]]) { # message="Don't know how to automatically pick scale for object of type ITime. Defaulting to continuous") # qplot() soon to be deleted, unclear how to adapt the test meaningfully after that... - invisible(try(qplot(), silent=TRUE)) # force deprecation warning + invisible(tryCatch(qplot(), condition=function(.) NULL)) # force deprecation warning test(1.5, all.equal( print(DT[, qplot(idate, as.POSIXct(itime, tzone=""))]), print(qplot(idate, as.POSIXct(itime, tzone=""), data=DT)))) From 20963c58902ec7f0face872ba8235173a68e8966 Mon Sep 17 00:00:00 2001 From: chiricom Date: Fri, 24 Jul 2026 16:20:44 +0000 Subject: [PATCH 8/8] cat(), not warning(), to avoid CI failure --- inst/tests/other.Rraw | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inst/tests/other.Rraw b/inst/tests/other.Rraw index 339577d76..d2733e732 100644 --- a/inst/tests/other.Rraw +++ b/inst/tests/other.Rraw @@ -201,7 +201,9 @@ if (loaded[["knitr"]]) { if (loaded[["parallel"]]) { #1745 and #1727 if (.Platform$OS.type=="windows") { - warning("This test of auto fallback to single threaded mode when data.table is used from package parallel, does not run on Windows because 'mc.cores'>1 is not supported on Windows; i.e., parallel package isn't parallel on Windows, IIUC. Whereas data.table is parallel built-in on Windows for some functions (fwrite/fread/fsort and expanding) using OpenMP.") + cat( + strwrap("This test of auto fallback to single threaded mode when data.table is used from package parallel, does not run on Windows because 'mc.cores'>1 is not supported on Windows; i.e., parallel package isn't parallel on Windows, IIUC. Whereas data.table is parallel built-in on Windows for some functions (fwrite/fread/fsort and expanding) using OpenMP.\n"), + sep="\n") } else { setDTthreads(2) if (getDTthreads()!=2) {