Skip to content

Commit

Permalink
unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dansmith01 committed Oct 9, 2024
1 parent b7dee3f commit 6725420
Show file tree
Hide file tree
Showing 17 changed files with 771 additions and 337 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
^docs$
^pkgdown$
^\.github$
^codecov\.yml$
61 changes: 61 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

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

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Imports:
R6,
rlang
Suggests:
testthat
testthat (>= 3.0.0)
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ importFrom("callr", "r_session", "r_session_options")
importFrom("cli",
"cli_abort", "cli_bullets", "cli_div", "cli_end", "cli_fmt", "cli_text",
"cli_warn", "cli_rule", "col_grey", "col_green", "col_red", "col_yellow" )
importFrom("globals", "globalsOf")
importFrom("globals", "cleanup", "globalsOf")
importFrom("later", "later", "run_now")
importFrom("magrittr", "%>%", "%<>%")
importFrom("parallelly", "availableCores")
Expand All @@ -12,7 +12,7 @@ importFrom("promises",
"promise_race", "promise_reduce", "promise_resolve", "then" )
importFrom("R6", "R6Class")
importFrom("rlang",
"%||%", "as_environment", "as_function", "env_get", "env_has", "env_name",
"%||%", "as_environment", "as_function", "dots_list", "env_get", "env_has", "env_name",
"is_character", "is_formula", "is_false", "is_function", "is_list", "is_named",
"is_named2", "is_null", "is_na", "is_true", "is_scalar_character",
"is_scalar_integerish", "is_scalar_logical", "is_string", "new_environment" )
Expand Down
4 changes: 2 additions & 2 deletions R/future.r
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#' }
#'
#' class(jobqueue) <- c('JobQueuePlan', class(jobqueue))
#' attr(jobqueue, "tweakable") <- c('tmax', 'hooks', 'stop_id', 'copy_id', 'cpus', 'queue')
#' attr(jobqueue, "tweakable") <- c('timeout', 'hooks', 'stop_id', 'copy_id', 'cpus', 'queue')
#'
#'
#' future_by_uid <- fastmap()
Expand Down Expand Up @@ -180,7 +180,7 @@
#' future$job <- queue$run(
#' expr = getExpression(future),
#' vars = globals,
#' tmax = future[['tmax']],
#' timeout = future[['timeout']],
#' hooks = future[['hooks']],
#' reformat = future[['reformat']],
#' cpus = future[['cpus']],
Expand Down
Loading

0 comments on commit 6725420

Please sign in to comment.