Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/cedta.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
36 changes: 21 additions & 15 deletions inst/tests/other.Rraw
Original file line number Diff line number Diff line change
@@ -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")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we maybe add a comment above why we enforce this ordering? seems out of the blue without reading later comment

# 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
Expand All @@ -27,7 +27,7 @@ INT = data.table:::INT
if (anyDuplicated(pkgs)) stop("Packages defined to be loaded for integration tests in 'inst/tests/other.Rraw' contains duplicates.")

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 at the end for #5101
)))
loaded = sapply(pkgs, f)
if (!all(loaded)) {
Expand Down Expand Up @@ -56,13 +56,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 = function(x) !inherits(tryCatch(print(x), error=identity), "error")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we really need this here? Previously we/you have used the test(, {print(DT); TRUE}) idiom e.g. in test 2187

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",
Expand All @@ -74,8 +73,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(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))))
try(graphics.off(), silent=TRUE)
}

if (loaded[["plyr"]]) {
Expand Down Expand Up @@ -166,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"]]) {
Expand Down Expand Up @@ -197,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) {
Expand Down
Loading