-
-
Notifications
You must be signed in to change notification settings - Fork 86
CRAN Parallelization
Marc Becker edited this page Nov 8, 2024
·
1 revision
CRAN does not allow packages to use more than 2 cores when running testthat.R
. The test on Debian then returns an error like this.
* checking tests ... [54s/18s] NOTE
Running ‘testthat.R’ [53s/18s]
Running R code in ‘testthat.R’ had CPU time 3 times elapsed time
Since CRAN does not say which test takes too long, this code can help to find the problem.
files = list.files("tests/testthat", "test_", full.names = TRUE)
for (file in files) {
time = system.time(test_file(file))
ratio = time[1] / time[3]
if (ratio > 2) {
print(time)
stopf("Test file %s had CPU time %f times elapsed time", file, ratio)
}
}
CI
Roxygen (Documentation)
Style
Misc