Skip to content

Commit

Permalink
adapted test for CRAN note
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardHooijmaijers committed Nov 12, 2024
1 parent 6383cfb commit d529260
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 19 deletions.
4 changes: 2 additions & 2 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.5.0
Date: 2024-11-08 13:46:24 UTC
SHA: 77cac2504d77bc8301d9c307e501011cad46af71
Date: 2024-11-11 14:52:47 UTC
SHA: 6383cfbb58ebad20005d83d85265f7f010208320
5 changes: 4 additions & 1 deletion tests/testthat/test-fit_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ test_that("fit_plot works as expected", {
expect_true(file.exists(paste0(temp_dir, "/analysis/test_model/fit_plot.html")))

# remove directory
unlink(paste0(temp_dir, "/analysis"), recursive = TRUE)
#unlink(paste0(temp_dir, "/analysis"), recursive = TRUE)
rml <- list.files(temp_dir, recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)


})
4 changes: 3 additions & 1 deletion tests/testthat/test-gof_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ test_that("gof_plot works as expected", {
expect_true(file.exists(paste0(temp_dir, "/analysis/test_model/gof_plot.html")))

# remove directory
unlink(paste0(temp_dir, "/analysis"), recursive = TRUE)
#unlink(paste0(temp_dir, "/analysis"), recursive = TRUE)
rml <- list.files(temp_dir, recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)

})
6 changes: 5 additions & 1 deletion tests/testthat/test-module_dataexplore.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("Can run a data exploration", {
# Don't run these tests on the CRAN build servers
skip_on_cran()

temp_dir <- tempdir()

Expand Down Expand Up @@ -107,6 +109,8 @@ test_that("Can run a data exploration", {
})
})

unlink(paste0(temp_dir, "/files"), recursive = TRUE)
#unlink(paste0(temp_dir, "/files"), recursive = TRUE)
rml <- list.files(temp_dir, recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)

})
6 changes: 5 additions & 1 deletion tests/testthat/test-module_metadata.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("Shiny app handles meta data correctly", {
# Don't run these tests on the CRAN build servers
skip_on_cran()

temp_dir <- tempdir()

Expand Down Expand Up @@ -33,5 +35,7 @@ test_that("Shiny app handles meta data correctly", {

})

unlink(paste0(temp_dir, "/files"), recursive = TRUE)
#unlink(paste0(temp_dir, "/files"), recursive = TRUE)
rml <- list.files(temp_dir, recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)
})
6 changes: 5 additions & 1 deletion tests/testthat/test-module_report.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

test_that("Shiny app creates plot and runs report", {
# Don't run these tests on the CRAN build servers
skip_on_cran()

temp_dir <- tempdir()

Expand Down Expand Up @@ -126,6 +128,8 @@ test_that("Shiny app creates plot and runs report", {
expect_equal(file.exists(paste0(temp_dir, "/files/analysis/run1/TestReport.html")), TRUE)
})

unlink(paste0(temp_dir, "/files"), recursive = TRUE)
#unlink(paste0(temp_dir, "/files"), recursive = TRUE)
rml <- list.files(temp_dir, recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)

})
6 changes: 5 additions & 1 deletion tests/testthat/test-module_run.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("Shiny app runs model", {
# Don't run these tests on the CRAN build servers
skip_on_cran()

temp_dir <- tempdir()

Expand Down Expand Up @@ -48,6 +50,8 @@ test_that("Shiny app runs model", {
expect_true(file.exists(paste0(temp_dir, "/files/shinyMixR/run1.ressum.rds")))
})

unlink(paste0(temp_dir, "/files"), recursive = TRUE)
#unlink(paste0(temp_dir, "/files"), recursive = TRUE)
rml <- list.files(temp_dir, recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)

})
6 changes: 5 additions & 1 deletion tests/testthat/test-module_script.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("Shiny app runs model and returns parameters for run1", {
# Don't run these tests on the CRAN build servers
skip_on_cran()

temp_dir <- tempdir()

Expand Down Expand Up @@ -47,6 +49,8 @@ test_that("Shiny app runs model and returns parameters for run1", {

})

unlink(paste0(temp_dir, "/files"), recursive = TRUE)
#unlink(paste0(temp_dir, "/files"), recursive = TRUE)
rml <- list.files(temp_dir, recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)

})
6 changes: 5 additions & 1 deletion tests/testthat/test-module_settings.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("Settings are handled correctly", {
# Don't run these tests on the CRAN build servers
skip_on_cran()

temp_dir <- tempdir()

Expand All @@ -22,6 +24,8 @@ test_that("Settings are handled correctly", {
expect_true(session$input$fontedt==8)
})

unlink(paste0(temp_dir, "/files"), recursive = TRUE)
#unlink(paste0(temp_dir, "/files"), recursive = TRUE)
rml <- list.files(temp_dir, recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)

})
4 changes: 3 additions & 1 deletion tests/testthat/test-par_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ test_that("partable works", {

expect_true(file.exists(paste0(tempdir(), "/files/analysis/run1/par_table.html")))

unlink(paste0(tempdir(), "/files"), recursive = TRUE)
#unlink(paste0(tempdir(), "/files"), recursive = TRUE)
rml <- list.files(tempdir(), recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)

})
6 changes: 5 additions & 1 deletion tests/testthat/test-run_nmx.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("run_nmx works as expected", {
# Don't run these tests on the CRAN build servers
skip_on_cran()

# create project
unlink(paste0(tempdir(),"/files"), recursive = TRUE)
Expand Down Expand Up @@ -39,5 +41,7 @@ test_that("run_nmx works as expected", {
expect_true(file.exists(paste0(tempdir(), "/files/shinyMixR/run1.ressum.rds")))

# remove project
unlink(paste0(tempdir(), "/files"), recursive = TRUE)
#unlink(paste0(tempdir(), "/files"), recursive = TRUE)
rml <- list.files(tempdir(), recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)
})
4 changes: 3 additions & 1 deletion tests/testthat/test-shinymixr-01-model-run1.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ test_that("Shiny app runs model and returns parameters for run1", {

# Stop and clean up
app$stop()
unlink(paste0(tempdir(),"/files"), recursive = TRUE)
#unlink(paste0(tempdir(),"/files"), recursive = TRUE)
rml <- list.files(tempdir(), recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)
})
4 changes: 3 additions & 1 deletion tests/testthat/test-shinymixr-02-parameter-table.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ test_that("Shiny app creates correct parameter table", {

# Stop and clean up
app$stop()
unlink(paste0(tempdir(),"/files"), recursive = TRUE)
#unlink(paste0(tempdir(),"/files"), recursive = TRUE)
rml <- list.files(tempdir(), recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)
})
4 changes: 3 additions & 1 deletion tests/testthat/test-shinymixr-03-create-newmodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,7 @@ test_that("Shiny app correctly creates new model code", {

# Stop and clean up
app$stop()
unlink(paste0(temp_dir, "/files"), recursive = TRUE)
#unlink(paste0(temp_dir, "/files"), recursive = TRUE)
rml <- list.files(tempdir(), recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)
})
4 changes: 3 additions & 1 deletion tests/testthat/test-tree_overview.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ test_that("tree overview works as expected", {
expect_equal(treeview$x$data$children[[1]]$name, "run1")

# remove project
unlink(paste0(tempdir(), "/files"), recursive = TRUE)
#unlink(paste0(tempdir(), "/files"), recursive = TRUE)
rml <- list.files(tempdir(), recursive = TRUE, include.dirs = TRUE, full.names = TRUE)
unlink(rml, recursive = TRUE)

})
6 changes: 3 additions & 3 deletions tests/testthat/test-update_inits.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ test_that("update_inits works as expected", {
script <- system.file("other", "run1.r", package = "shinyMixR")
res <- system.file("other", "run1.res.rds", package = "shinyMixR")

update_inits(readLines(script), res, paste0(temp_dir, "run2.r"))
update_inits(readLines(script), res, paste0(temp_dir, "/run2.r"))

# check if file has been written
expect_true(file.exists(paste0(temp_dir, "run2.r")))
expect_true(file.exists(paste0(temp_dir, "/run2.r")))

# unlink file
unlink(paste0(temp_dir, "run2.r"))
unlink(paste0(temp_dir, "/run2.r"))

})

0 comments on commit d529260

Please sign in to comment.