Skip to content

Commit

Permalink
Make covr mad (#158)
Browse files Browse the repository at this point in the history
* Try using testthat:::in_covr() fxn

* fix covr testing for zzz

* Remove print calls
  • Loading branch information
NeuroShepherd committed Nov 12, 2024
1 parent 9f2b149 commit a9a4388
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
4 changes: 2 additions & 2 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @return invisible
#' @keywords internal
#'
.onLoad <- function(libname, pkgname) { # nocov start
.onLoad <- function(libname, pkgname) {

op <- options()
op.ordinalsimr <- list(
Expand All @@ -25,4 +25,4 @@

invisible()

} # nocov end
}
15 changes: 2 additions & 13 deletions tests/testthat/test-zzz.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@


skip_on_covr()
skip_on_cran()

test_that("test .onLoad", {

is_chk <- Sys.getenv("_R_CHECK_PACKAGE_NAME_", "") == .packageName
not_cran <- Sys.getenv("NOT_CRAN") == "true"

print(paste(".packageName is", .packageName))
print(paste("_R_CHECK_PACKAGE_NAME_ is", Sys.getenv("_R_CHECK_PACKAGE_NAME_", "")))
print(paste("NOT_CRAN is", Sys.getenv("NOT_CRAN")))
print(paste("is_chk is", is_chk))
print(paste("not_cran is", not_cran))



if (is_chk) {
if (testthat:::in_rcmd_check() || testthat:::in_covr()) {

indep_session <- callr::r(function() {
ordinalsimr_opts_preload <- grep("ordinalsimr.", names(options()), value = TRUE) |>
Expand Down Expand Up @@ -52,9 +42,8 @@ test_that("test .onLoad", {
expect_equal(indep_session$ordinalsimr_opts_postload$ordinalsimr.default_size_min, 30)
expect_equal(indep_session$ordinalsimr_opts_postload$ordinalsimr.default_size_max, 200)
expect_equal(indep_session$ordinalsimr_opts_postload$ordinalsimr.default_ratio, "50:50")
} else if(!is_chk) {
} else if(!testthat:::in_rcmd_check()) {

print("Any other condition")

indep_session <- callr::r(function() {
ordinalsimr_opts_preload <- grep("ordinalsimr.", names(options()), value = TRUE) |>
Expand Down

0 comments on commit a9a4388

Please sign in to comment.