From cdc67df754ceefaef4b9a72e20040d85593359e5 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Wed, 27 Nov 2019 18:35:39 -0500 Subject: [PATCH] V0.3.1 rc (release for addressing CRAN errors) (#115) * Update create_credentials.R It is thought that including the only function from the `getPass` pkg in an argument leads some CRAN check machines to believe the Import is unused. This change is thus just for passing R CMD check more widely. * Limit testing of rmarkdown-based tests To only those systems with Pandoc 2 * Update Version and NEWS.md * Added SystemRequirements (pandoc) This is required according to WRE. * Substitute function used for checking Pandoc status Now using the exported `rmarkdown::pandoc_available()` function. --- DESCRIPTION | 3 +- NEWS.md | 4 ++ R/create_credentials.R | 14 ++++++- tests/testthat/test-utils.R | 75 ++++++++++++++++++++----------------- 4 files changed, 59 insertions(+), 37 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d0d18d00..30328417 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: blastula Title: Easily Send HTML Email Messages -Version: 0.3.0 +Version: 0.3.1 Authors@R: c( person("Richard", "Iannone", role = c("aut", "cre"), email = "riannone@me.com", comment = c(ORCID = "0000-0003-3925-190X")), @@ -45,6 +45,7 @@ Suggests: knitr, spelling, xml2 +SystemRequirements: pandoc (>= 1.12.3) - http://pandoc.org Encoding: UTF-8 LazyData: true RoxygenNote: 6.1.1 diff --git a/NEWS.md b/NEWS.md index 68439a58..0f526058 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# blastula 0.3.1 + +This release contains fixes for R CMD check problems on CRAN test machines. + # blastula 0.3.0 The **blastula** package has transitioned to using the **curl** package for SMTP mailing. diff --git a/R/create_credentials.R b/R/create_credentials.R index b9074b0a..0b60d4a6 100644 --- a/R/create_credentials.R +++ b/R/create_credentials.R @@ -155,12 +155,24 @@ create_smtp_creds_key <- function(id, # nocov end } +#' Ask for a password +#' +#' @noRd +get_password <- function(msg = "Enter the SMTP server password: ") { + + # nocov start + + getPass::getPass(msg = msg) + + # nocov end +} + #' Create a credentials list object #' #' @noRd create_credentials_list <- function(provider, user, - password = getPass::getPass("Enter the SMTP server password: "), + password = get_password(), host, port, use_ssl) { diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 63499536..b5b7bfb0 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -2,47 +2,52 @@ context("Utility functions work as expected") test_that("knitr_sidecar_prefix preconditions hold", { - # Ensure that rmarkdown assumptions still hold - rmd_path <- file.path(tempdir(), "test-utils.Rmd") + if (rmarkdown::pandoc_available()) { - file.copy(testthat::test_path("test-utils.Rmd"), rmd_path) + # Ensure that rmarkdown assumptions still hold + rmd_path <- file.path(tempdir(), "test-utils.Rmd") - rmarkdown::render(rmd_path, quiet = TRUE) + file.copy(testthat::test_path("test-utils.Rmd"), rmd_path) + + rmarkdown::render(rmd_path, quiet = TRUE) + } }) test_that("knitr_sidecar_prefix behavior", { - # fig.path isn't set - expect_null(knitr_sidecar_prefix(NULL)) - expect_null(knitr_sidecar_prefix(NULL, condition = FALSE)) - expect_null(knitr_sidecar_prefix(NULL, condition = TRUE)) - expect_identical("default", knitr_sidecar_prefix("default")) - expect_identical("default", knitr_sidecar_prefix("default", condition = FALSE)) - expect_identical("default", knitr_sidecar_prefix("default", condition = TRUE)) - - # Explicitly provide an unusable fig.path - expect_null(knitr_sidecar_prefix(NULL, fig_path = ".")) - expect_null(knitr_sidecar_prefix(NULL, condition = FALSE, fig_path = ".")) - expect_null(knitr_sidecar_prefix(NULL, condition = TRUE, fig_path = ".")) - expect_identical("default", knitr_sidecar_prefix("default", fig_path = ".")) - expect_identical("default", knitr_sidecar_prefix("default", condition = FALSE, fig_path = ".")) - expect_identical("default", knitr_sidecar_prefix("default", condition = TRUE, fig_path = ".")) - - # Usable fig.path provided - expect_identical( - knitr_sidecar_prefix(NULL, condition = TRUE, - fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/"), - "a12 !_-x_files/b" - ) - expect_null( - knitr_sidecar_prefix(NULL, condition = FALSE, - fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/") - ) - expect_null( - knitr_sidecar_prefix(NULL, - fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/") - ) - + if (rmarkdown::pandoc_available()) { + + # fig.path isn't set + expect_null(knitr_sidecar_prefix(NULL)) + expect_null(knitr_sidecar_prefix(NULL, condition = FALSE)) + expect_null(knitr_sidecar_prefix(NULL, condition = TRUE)) + expect_identical("default", knitr_sidecar_prefix("default")) + expect_identical("default", knitr_sidecar_prefix("default", condition = FALSE)) + expect_identical("default", knitr_sidecar_prefix("default", condition = TRUE)) + + # Explicitly provide an unusable fig.path + expect_null(knitr_sidecar_prefix(NULL, fig_path = ".")) + expect_null(knitr_sidecar_prefix(NULL, condition = FALSE, fig_path = ".")) + expect_null(knitr_sidecar_prefix(NULL, condition = TRUE, fig_path = ".")) + expect_identical("default", knitr_sidecar_prefix("default", fig_path = ".")) + expect_identical("default", knitr_sidecar_prefix("default", condition = FALSE, fig_path = ".")) + expect_identical("default", knitr_sidecar_prefix("default", condition = TRUE, fig_path = ".")) + + # Usable fig.path provided + expect_identical( + knitr_sidecar_prefix(NULL, condition = TRUE, + fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/"), + "a12 !_-x_files/b" + ) + expect_null( + knitr_sidecar_prefix(NULL, condition = FALSE, + fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/") + ) + expect_null( + knitr_sidecar_prefix(NULL, + fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/") + ) + } }) test_that("the `smtp_settings()` function returns the expected output", {