tests/test-all.R

if (Sys.getenv("_LOCAL_TESTS_")=="TRUE") { ## not on CRAN
  if(require("testthat", quietly = TRUE)) {
    pkg   <- "genepop"
    require(pkg, character.only=TRUE, quietly=TRUE)
    if (interactive())  {} else {
      report <- test_check(pkg) ## for R CMD check ## report is NULL...
      print(warnings()) # TODO? catch most of these by expect_warning(..)
    }
    if (FALSE) { ## tests not included in package (using data not included, etc.)
      priv_testfiles <- dir(paste0("./package/tests_private/"),pattern="*.R$",full.names = TRUE)
      priv_timings <- t(sapply(priv_testfiles, function(fich){
        cat(paste0("\n",fich))
        gc()
        tps <- system.time(chk <- try(source(fich)), gcFirst=FALSE)
        if (inherits(chk,"try-error")) warning(paste0(fich," generated an error"))
        tps
      }))
      print(colSums(priv_timings)) # very roughly 1205.44 s elapsed for default maxtime (0.7) # much less after improving COMP
    }
  } else {
    cat( "package 'testthat' not available, cannot run unit tests\n" )
  }
}

# tools::compactPDF("D:/home/francois/travail/stats/Genepopplus/Genepop-FR/genepop/inst/doc")

Try the genepop package in your browser

Any scripts or data that you put into this service are public.

genepop documentation built on Jan. 23, 2026, 5:06 p.m.