Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bhelsel committed Feb 29, 2024
1 parent c47daef commit 0568e85
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 28 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master, development]
branches: [main, master]
pull_request:
branches: [main, master, development]
branches: [main, master]

name: test-coverage

Expand All @@ -23,22 +23,9 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr remotes
extra-packages: any::covr
needs: coverage

- uses: actions/setup-python@4
with:
Python-version: '3.11'

- name: setup r-reticulate venv
shell: Rscript {0}
run: |
remotes::install_local()
reticulate::virtualenv_create("agcounts", Sys.which("python"))
reticulate::virtualenv_install("agcounts", c("numpy", "pandas", "pygt3x"))
python <- reticulate::virtualenv_python("agcounts")
writeLines(sprintf("RETICULATE_PYTHON=%s", python), Sys.getenv("GITHUB_ENV"))
- name: Test coverage
run: |
covr::codecov(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_actilife_counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

testthat::test_that("agcounts and Actilife counts are the same",{

#skip_if(!py_module_available("pygt3x"))
skip_if(!py_module_available("pygt3x"))
gt3xPath <- system.file("extdata/example.gt3x", package = "agcounts")
agdPath <- system.file("extdata/example5sec.agd", package = "agcounts")

Expand Down
15 changes: 8 additions & 7 deletions tests/testthat/test_agread.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Copyright © 2022 University of Kansas. All rights reserved.

testthat::test_that("Check that data can be read into agcounts using each agread method", {

#skip_if(!py_module_available("pygt3x"))

testthat::test_that("Check that data can be read into agcounts using pygt3x", {
skip_if(!py_module_available("pygt3x"))
file <- system.file("extdata/example.gt3x", package = "agcounts")

expect_error(agread(path = file, parser = "no parser"))

pygt3x <- agread(path = file, parser = "pygt3x", verbose = FALSE)
expect_equal(nrow(pygt3x), 18000)
expect_equal(ncol(pygt3x), 4)
})


testthat::test_that("Check that data can be read into agcounts using each agread method", {
file <- system.file("extdata/example.gt3x", package = "agcounts")
expect_error(agread(path = file, parser = "no parser"))

invisible(capture.output(ggir <- agread(path = file, parser = "GGIR", verbose = FALSE)))
expect_equal(nrow(ggir), 18000)
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_shinyReactable.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright © 2022 University of Kansas. All rights reserved.

testthat::test_that("Test raw module reactable table output", {
#skip_if(!py_module_available("pygt3x"))
app <- shinytest2::AppDriver$new(agShinyDeployApp())
app$upload_file(`rawDataModule-gt3xFile` = system.file("extdata/example.gt3x", package = "agcounts"))
app$set_inputs(`rawDataModule-parser` = "read.gt3x")
Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test_shinyServer.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright © 2022 University of Kansas. All rights reserved.

testthat::test_that("Shiny app rawDataModuleServer loads raw acceleration data", {
#skip_if(!py_module_available("pygt3x"))
skip_if(!py_module_available("pygt3x"))
shiny::testServer(rawDataModuleServer, {
path = system.file("extdata/example.gt3x", package = "agcounts")
session$setInputs(gt3xFile = list(datapath = path), parser = "pygt3x",
Expand Down Expand Up @@ -31,7 +31,7 @@ testthat::test_that("Shiny app rawDataModuleServer loads raw acceleration data",
})

testthat::test_that("Shiny app rawDataModuleServer loads dynamic UI", {
#skip_if(!py_module_available("pygt3x"))

app <- shinytest2::AppDriver$new(agShinyDeployApp())
app$upload_file(`rawDataModule-gt3xFile` = system.file("extdata/example.gt3x", package = "agcounts"))
app$set_inputs(`rawDataModule-parser` = "read.gt3x")
Expand All @@ -52,7 +52,6 @@ testthat::test_that("Shiny app rawDataModuleServer loads dynamic UI", {

testthat::test_that("Shiny app compareCountsModule loads agd data", {

#skip_if(!py_module_available("pygt3x"))
shiny::testServer(compareCountsModuleServer, {
path = system.file("extdata/calibration1sec.agd", package = "agcounts")
data <- .read_agd(path)
Expand Down

0 comments on commit 0568e85

Please sign in to comment.