From 10d4f99e2a4dded61e8641f2e6e384f40b017f03 Mon Sep 17 00:00:00 2001 From: Benjamin Christoffersen Date: Sat, 19 Jan 2019 13:29:26 +0100 Subject: [PATCH] do not show an error when nthreads is not changed --- R/parglm.R | 9 +++++---- cran-comments.md | 5 +++-- tests/testthat/test_misc.R | 2 ++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/R/parglm.R b/R/parglm.R index 089c736..35b91e0 100644 --- a/R/parglm.R +++ b/R/parglm.R @@ -177,10 +177,11 @@ parglm.fit <- function( if(nthreads_new < 1L) nthreads_new <- 1L - warning( - "Too few observation compared to the number of threads. ", - nthreads_new, " thread(s) will be used instead of ", - control$nthreads, ".") + if(control$nthreads != nthreads_new) + warning( + "Too few observation compared to the number of threads. ", + nthreads_new, " thread(s) will be used instead of ", + control$nthreads, ".") control$nthreads <- nthreads_new } diff --git a/cran-comments.md b/cran-comments.md index d03e8c0..0b060f4 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -16,5 +16,6 @@ solaris-x86-patched ## R CMD check results -There were no ERRORs, or WARNINGs. There is a NOTE on `fedora-gcc-devel` and -`debian-gcc-release` on rhub about the size of the package. +There were no ERRORs, or WARNINGs. There is a NOTE on `fedora-gcc-devel` +on rhub, my local machine, and `debian-gcc-release` on rhub about the size +of the package. diff --git a/tests/testthat/test_misc.R b/tests/testthat/test_misc.R index 9680424..9262093 100644 --- a/tests/testthat/test_misc.R +++ b/tests/testthat/test_misc.R @@ -29,4 +29,6 @@ test_that("Using more threads then rows yields a warning", { parglm( a ~ b - 1, data = this_df , nthreads = 64), regexp = "Too few observation compared to the number of threads. 1 thread(s) will be used instead of 64.", fixed = TRUE) + + expect_silent(parglm( a ~ b - 1, data = this_df , nthreads = 1)) })