Skip to content

Commit

Permalink
Change unit testing from testthat to tinytest. Fix unit test of "/opt…
Browse files Browse the repository at this point in the history
…" folder
  • Loading branch information
jwijffels committed Aug 26, 2021
1 parent 51a63e0 commit 791556a
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 41 deletions.
15 changes: 8 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
Package: cronR
Type: Package
Title: Schedule R Scripts and Processes with the 'cron' Job Scheduler
Version: 0.5.0
Authors@R: c(person("Jan", "Wijffels", role = c("aut", "cre", "cph"), email =
"[email protected]"), person("BNOSAC", role = "cph"), person("Kevin", "Ushey",
role = c("cph"), email = "[email protected]"))
Version: 0.5.1
Authors@R: c(
person("Jan", "Wijffels", role = c("aut", "cre", "cph"), email = "[email protected]"),
person("BNOSAC", role = "cph"),
person("Kevin", "Ushey", role = c("cph"), email = "[email protected]"))
Maintainer: Jan Wijffels <[email protected]>
Description: Create, edit, and remove 'cron' jobs on your unix-alike system. The package provides a set of easy-to-use wrappers
to 'crontab'. It also provides an RStudio add-in to easily launch and schedule your scripts.
URL: https://github.com/bnosac/cronR
Imports:
Imports:
digest
Suggests:
Suggests:
knitr,
rmarkdown,
miniUI,
shiny (>= 0.11),
shinyFiles (>= 0.6.0),
testthat
tinytest
License: MIT + file LICENSE
VignetteBuilder: knitr
OS_type: unix
Expand Down
5 changes: 5 additions & 0 deletions inst/NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Package: cronR
================

Version: 0.5.1 [2021-08-26]

- Switch unit testing from testthat to tinytest
- Fix unit test if user has access rights to /opt folder (e.g. as root)

Version: 0.5.0 [2021-08-20]

- Change default directory of R script deployment in the addin: cron_rstudioaddin
Expand Down
6 changes: 6 additions & 0 deletions inst/tinytest/test_cron_add.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
myscript <- system.file("extdata", "helloworld.R", package = "cronR")

f <- system.file(package = "cronR", "extdata", "helloworld.R")
cmd <- cron_rscript(f)
expect_silent(cron_add(command = cmd, frequency = 'minutely', id = 'abc', description = 'My process 1'))
expect_silent(cron_clear(ask = FALSE))
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
context("cronR-general")

test_that("cronR general examples work as expected", {
skip_on_cran()

expect_silent({
cron_ls()
cron_njobs()
cron_add("testing!", id="abc", tags=c("test1", "test2"),
Expand Down Expand Up @@ -32,6 +29,4 @@ test_that("cronR general examples work as expected", {
cron_njobs()
cron_ls("abc")
cron_clear(FALSE)

})

12 changes: 12 additions & 0 deletions inst/tinytest/test_verify_script_path.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
path <- "/opt"
if(!is.na(file.info(path)$isdir) && file.access(path, mode = 2)){
expect_warning(
cronR:::verify_rscript_path(path),
"You do not have write access to the specified Rscript repository path, /opt."
)
}

expect_warning(
cronR:::verify_rscript_path("/DirClearlyDoesNotExist"),
"The specified Rscript repository path /DirClearlyDoesNotExist does not exist, make sure this is an existing directory without spaces."
)
3 changes: 0 additions & 3 deletions tests/testthat.R

This file was deleted.

12 changes: 0 additions & 12 deletions tests/testthat/test-cron_add.R

This file was deleted.

13 changes: 0 additions & 13 deletions tests/testthat/test-verify_script_path.R

This file was deleted.

4 changes: 4 additions & 0 deletions tests/tinytest.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if(requireNamespace("tinytest", quietly=TRUE)){
home <- identical(Sys.getenv("HONEYIMHOME"), "TRUE") || identical(Sys.info()[["nodename"]], "live")
tinytest::test_package("cronR", at_home = home)
}

0 comments on commit 791556a

Please sign in to comment.