r-lib / testthat

An R 📦 to make testing 😀
https://testthat.r-lib.org
Other
892 stars 318 forks source link

CRAN noSuggests enforcement affects C++ Catch through `xml2`. #1947

Closed doccstat closed 1 week ago

doccstat commented 7 months ago

CRAN error page and Affected package page

noSuggests error ``` * using log directory ‘/data/gannet/ripley/R/packages/tests-Suggests/fastcpd.Rcheck’ * using R Under development (unstable) (2024-03-28 r86224) * using platform: x86_64-pc-linux-gnu * R was compiled by gcc-13 (GCC) 13.2.0 GNU Fortran (GCC) 13.2.0 * running under: Fedora Linux 36 (Workstation Edition) * using session charset: UTF-8 * using option ‘--no-stop-on-test-error’ * checking for file ‘fastcpd/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘fastcpd’ version ‘0.12.2’ * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... NOTE Package suggested but not available for checking: ‘gfpop’ * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘fastcpd’ can be installed ... [244s/84s] OK * used C++ compiler: ‘g++-13 (GCC) 13.2.0’ * checking package directory ... OK * checking ‘build’ directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [20s/24s] OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of ‘data’ directory ... OK * checking data for non-ASCII characters ... OK * checking LazyData ... OK * checking data for ASCII and uncompressed saves ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking compilation flags in Makevars ... OK * checking for GNU extensions in Makefiles ... OK * checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK * checking use of PKG_*FLAGS in Makefiles ... OK * checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK * checking pragmas in C/C++ headers and code ... OK * checking compilation flags used ... OK * checking compiled code ... OK * checking installed files from ‘inst/doc’ ... OK * checking files in ‘vignettes’ ... OK * checking examples ... [143s/170s] OK * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... Running ‘testthat.R’ [583s/317s] [583s/318s] ERROR Running the tests in ‘tests/testthat.R’ failed. Complete output: > library(testthat) > library(fastcpd) > > test_check("fastcpd") Starting 2 test processes [ FAIL 2 | WARN 0 | SKIP 10 | PASS 72 ] ══ Skipped tests (10) ══════════════════════════════════════════════════════════ • Skip due to time limit on CRAN. (1): 'test-vignettes-comparison-pelt.R:4:1' • These tests are intended to be run manually. (1): 'test-experiments.R:1:1' • gridExtra cannot be loaded (1): 'test-examples-data-transcriptome.R:4:5' • lubridate cannot be loaded (1): 'test-examples-data-uk_seatbelts.R:4:5' • matrixStats cannot be loaded (1): 'test-examples-data-well_log-quantile.R:4:5' • mockthat cannot be loaded (1): 'test-fastcpd-class.R:3:5' • mvtnorm cannot be loaded (4): 'test-examples-fastcpd_1.R:4:5', 'test-examples-fastcpd_2.R:4:5', 'test-examples-fastcpd_3.R:4:5', 'test-examples-fastcpd_4.R:4:5' ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-cpp.R:1:1'): (code run outside of `test_that()`) ─────────────── Error in `run_cpp_tests("fastcpd")`: The package "xml2" is required to run run_cpp_tests() Backtrace: ▆ 1. └─testthat::run_cpp_tests("fastcpd") at test-cpp.R:1:1 2. └─rlang::check_installed("xml2", "to run run_cpp_tests()") ── Error ('test-coverage.R:7:5'): vanilla_percentage ─────────────────────────── Error in `loadNamespace(x)`: there is no package called 'mvtnorm' Backtrace: ▆ 1. └─base::loadNamespace(x) at test-coverage.R:7:5 2. └─base::withRestarts(stop(cond), retry_loadNamespace = function() NULL) 3. └─base (local) withOneRestart(expr, restarts[[1L]]) 4. └─base (local) doWithOneRestart(return(expr), restart) [ FAIL 2 | WARN 0 | SKIP 10 | PASS 72 ] Error: Test failures Execution halted * checking for unstated dependencies in vignettes ... OK * checking package vignettes ... OK * checking re-building of vignette outputs ... OK * checking PDF version of manual ... [9s/20s] OK * checking HTML version of manual ... OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * DONE Status: 1 ERROR, 1 NOTE See ‘/data/gannet/ripley/R/packages/tests-Suggests/fastcpd.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 12:08.55, 1035.31 + 46.04 ```
Package description ``` Type: Package Package: fastcpd Title: Fast Change Point Detection via Sequential Gradient Descent Version: 0.12.2 Authors@R: c( person("Xingchi", "Li", , "anthony.li@stat.tamu.edu", role = c("aut", "cre", "cph"), comment = c(ORCID = "0009-0006-2493-0853")), person("Xianyang", "Zhang", , "zhangxiany@stat.tamu.edu", role = c("aut", "cph")), person("Trisha", "Dawn", , "trisha@stat.tamu.edu", role = c("aut", "cph")) ) Description: Implements fast change point detection algorithm based on the paper "Sequential Gradient Descent and Quasi-Newton's Method for Change-Point Analysis" by Xianyang Zhang, Trisha Dawn . The algorithm is based on dynamic programming with pruning and sequential gradient descent. It is able to detect change points a magnitude faster than the vanilla Pruned Exact Linear Time(PELT). The package includes examples of linear regression, logistic regression, Poisson regression, penalized linear regression data, and whole lot more examples with custom cost function in case the user wants to use their own cost function. License: GPL (>= 3) URL: https://fastcpd.xingchi.li, https://github.com/doccstat/fastcpd BugReports: https://github.com/doccstat/fastcpd/issues Depends: R (>= 2.10) Imports: fastglm, forecast, glmnet, Matrix, methods, Rcpp (>= 0.11.0), stats, tseries, utils Suggests: abind, breakfast, changepoint, cpm, CptNonPar, ecp, fpop, gfpop, ggplot2, gridExtra, InspectChangepoint, jointseg, knitr, lubridate, matrixStats, mcp, mockthat, mosum, mvtnorm, not, numDeriv, Rbeast, rmarkdown, segmented, stepR, strucchange, testthat (>= 3.0.0), VARDetect, wbs, xml2, zoo LinkingTo: progress, Rcpp, RcppArmadillo, testthat VignetteBuilder: knitr Config/testthat/edition: 3 Config/testthat/parallel: true Config/testthat/start-first: vignettes-comparison-pelt, fastcpd_ts Encoding: UTF-8 LazyData: true RoxygenNote: 7.2.3 ```

It seems that CRAN started to enforce the noSuggests error as I have always add xml2 as suggests to use C++ Catch tests. Should I move xml2 to Imports manually or if xml2 should be added to Imports automatically in the future?

hadley commented 1 week ago

I don't believe that CRAN's noSuggest policy can work in general, and IIRC it's currently only applied punitively if your package fails R CMD check for some other reason.