rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
133 stars 81 forks source link

skip tests that call rmarkdown on CRAN, which requires newer pandoc #975

Closed aronatkins closed 1 year ago

aronatkins commented 1 year ago

The R macOS checks started failing because the available pandoc was older than 1.12.3, which prevented the publication of rsconnect 1.0.2.

checking tests ... [46s/50s] ERROR
  Running ‘testthat.R’ [46s/49s]
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
   6. └─rmarkdown:::stop2(paste(msg, collapse = " "))
  ── Error ('test-deployDoc.R:65:3'): regular rmd deploys renv.lock, if present ──
  Error: pandoc version 1.12.3 or higher is required and was not found (see the help page ?rmarkdown::pandoc_available).
  Backtrace:
      ▆
   1. └─rsconnect:::standardizeSingleDocDeployment(...) at test-deployDoc.R:65:2
   2. └─rmarkdown::find_external_resources(path)
   3. └─rmarkdown:::discover_rmd_resources(input_file, discover_single_resource)
   4. └─rmarkdown::render(...)
   5. └─rmarkdown::pandoc_available(required_pandoc, error = TRUE)
   6. └─rmarkdown:::stop2(paste(msg, collapse = " "))

  [ FAIL 4 | WARN 0 | SKIP 118 | PASS 608 ]
  Error: Test failures
  Execution halted

related: rmarkdown test skipping: https://github.com/rstudio/rmarkdown/blob/main/tests/testthat.R

https://cran.rstudio.com/web/checks/check_results_rsconnect.html

aronatkins commented 1 year ago

Tested that pandoc is not required for the tests by creating a Docker container and running tests inside there.

Some notes from that experiment:

docker run -it --rm -v $(pwd):/rsconnect rstudio/r-base:4.3.0 bash

apt-get update && apt-get install -y libssl-dev libsodium-dev pkg-config libxml2-dev libjpeg-dev libpng-dev libtiff-dev

R -s -e 'install.packages(c("BiocManager","foreign","knitr","MASS","plumber","quarto","RCurl","reticulate","rmarkdown","shiny","testthat","webfakes","withr"), repos = c(CRAN = "https://cran.rstudio.com"))

R -s -e 'install.packages("rsconnect", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("BiocManager", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("foreign", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("knitr", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("MASS", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("plumber", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("quarto", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("RCurl", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("reticulate", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("rmarkdown", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("shiny", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("testthat", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("webfakes", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'install.packages("withr", repos = c(CRAN = "https://cran.rstudio.com"))'
R -s -e 'BiocManager::install("Biobase")'

apt-get install -y qpdf tidy

# no latex

mv /usr/bin/pandoc /usr/bin/pandoc.bak

R CMD build rsconnect
R CMD check --as-cran rsconnect_*.tar.gz

This produced some warnings and notes, but tests passed.

* checking top-level files ... NOTE
Files ‘README.md’ or ‘NEWS.md’ cannot be checked without ‘pandoc’ being installed.
...
* checking tests ...
  Running ‘testthat.R’ [38s/23s]
 [38s/23s] OK
...
* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
* checking PDF version of manual without index ... ERROR