topipa/iwmm

Skip `cmdstan`-related test if `cmdstan` is not detected instead of failing it

Closed this issue · 3 comments

Currently tests are run regardless of cmdstan being installed, which leads to a failure in a case it is not. The test should be instead skipped, I think.

--->  Testing R-iwmm
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-iwmm/R-iwmm/work/iwmm-b40fdc398f4d8ffe5e32aa2a8367cb3d3db6607c" && /opt/local/bin/R CMD check ./iwmm_0.0.1.tar.gz --no-manual --no-build-vignettes 
* using log directory ‘/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-iwmm/R-iwmm/work/iwmm-b40fdc398f4d8ffe5e32aa2a8367cb3d3db6607c/iwmm.Rcheck’
* using R version 4.4.1 (2024-06-14)
* using platform: powerpc-apple-darwin10.0.0d2 (32-bit)
* R was compiled by
    gcc-mp-13 (MacPorts gcc13 13.3.0_0+stdlib_flag) 13.3.0
    GNU Fortran (MacPorts gcc13 13.3.0_0+stdlib_flag) 13.3.0
* running under: OS X Snow Leopard 10.6
* using session charset: UTF-8
* using options ‘--no-manual --no-build-vignettes’
* checking for file ‘iwmm/DESCRIPTION’ ... OK
* this is package ‘iwmm’ version ‘0.0.1’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* 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 ... NOTE
Found the following hidden files and directories:
  .lintr
These were most likely included in error. See section ‘Package
structure’ in the ‘Writing R Extensions’ manual.
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘iwmm’ can be installed ... OK
* checking installed package size ... OK
* checking package 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 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 ... OK
* checking Rd files ... OK
* checking Rd metadata ... 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 files in ‘vignettes’ ... WARNING
Files in the 'vignettes' directory but no files in 'inst/doc':
  ‘importance_sampling_bootstrap.Rmd’ ‘iwmm.Rmd’
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘testthat.R’
 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
  
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 58 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-moment-match-cmdstan-analytical.R:35:3'): (code run outside of `test_that()`) ──
  Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
  Backtrace:
      ▆
   1. └─cmdstanr::cmdstan_model(...) at test-moment-match-cmdstan-analytical.R:35:3
   2.   └─cmdstanr::cmdstan_version()
   3.     └─cmdstanr:::stop_no_path()
  
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 58 ]
  Error: Test failures

Hi @barracuda156 . Thanks for pointing this out! I have added a check for cmdstan path in #17.

Great, thanks!

Closing as fixed