1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 04:46:11 +01:00

(v1.6.0.9058) unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-05-22 08:58:51 +02:00
parent 808024c5f4
commit 0b1f59edec
15 changed files with 51 additions and 47 deletions

View File

@ -43,39 +43,40 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master - uses: r-lib/actions/setup-r@v1
with:
r-version: release
- uses: r-lib/actions/setup-pandoc@master - uses: r-lib/actions/setup-pandoc@master
- name: Query dependencies - name: Restore cached R packages
run: | # this step will add the step 'Post Restore cached R packages' on a succesful run
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Cache R packages
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ${{ env.R_LIBS_USER }} path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} key: macOS-latest-r-release-v4
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install dependencies - name: Unpack AMR and install R dependencies
run: | run: |
install.packages(c("remotes", "tinytest")) tar -xf data-raw/AMR_latest.tar.gz
remotes::install_deps(dependencies = TRUE) Rscript -e "source('data-raw/_install_deps.R')"
remotes::install_cran("covr") Rscript -e "install.packages('covr')"
remotes::install_local("data-raw/AMR_latest.tar.gz") shell: bash
- name: Show session info
run: |
options(width = 100)
utils::sessionInfo()
as.data.frame(utils::installed.packages())[, "Version", drop = FALSE]
shell: Rscript {0} shell: Rscript {0}
- name: Test coverage - name: Test coverage
run: | run: |
library(AMR) library(AMR)
library(tinytest) library(tinytest)
source_files <- list.files("R", pattern = ".R$", full.names = TRUE) source_files <- list.files("AMR/R", pattern = ".R$", full.names = TRUE)
test_files <- list.files("inst/tinytest", full.names = TRUE) test_files <- list.files("AMR/inst/tinytest", full.names = TRUE)
cov <- covr::file_coverage(source_files = source_files, test_files = test_files, parent_env = asNamespace("AMR"), line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/translate.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R")) cov <- covr::file_coverage(source_files = source_files, test_files = test_files, parent_env = asNamespace("AMR"), line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/translate.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R"))
attr(cov, which = "package") <- list(path = ".") # until https://github.com/r-lib/covr/issues/478 is solved attr(cov, which = "package") <- list(path = "AMR") # until https://github.com/r-lib/covr/issues/478 is solved
covr::codecov(cov, quiet = FALSE) covr::codecov(cov, quiet = FALSE)
shell: Rscript {0} shell: Rscript {0}

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.6.0.9056 Version: 1.6.0.9058
Date: 2021-05-21 Date: 2021-05-22
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),

View File

@ -1,5 +1,5 @@
# `AMR` 1.6.0.9056 # `AMR` 1.6.0.9058
## <small>Last updated: 21 May 2021</small> ## <small>Last updated: 22 May 2021</small>
### Breaking change ### Breaking change
* All antibiotic class selectors (such as `carbapenems()`, `aminoglycosides()`) can now be used for filtering as well, making all their accompanying `filter_*()` functions redundant (such as `filter_carbapenems()`, `filter_aminoglycosides()`). These functions are now deprecated and will be removed in a next release. * All antibiotic class selectors (such as `carbapenems()`, `aminoglycosides()`) can now be used for filtering as well, making all their accompanying `filter_*()` functions redundant (such as `filter_carbapenems()`, `filter_aminoglycosides()`). These functions are now deprecated and will be removed in a next release.

Binary file not shown.

View File

@ -25,17 +25,15 @@
# some old R instances have trouble installing tinytest, so we ship it too # some old R instances have trouble installing tinytest, so we ship it too
install.packages("data-raw/tinytest_1.2.4.patched.tar.gz") install.packages("data-raw/tinytest_1.2.4.patched.tar.gz")
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
descr <- readLines("AMR/DESCRIPTION") pkg_suggests <- gsub("[^a-zA-Z0-9]+", "", unlist(strsplit(packageDescription("AMR", fields = "Suggests"), ", ?")))
pkg_suggests <- gsub(".*Suggests: (.*)*?[A-Z].*", "\\1", paste0(descr, "*", collapse = ""), perl = FALSE)
pkg_suggests <- unlist(strsplit(pkg_suggests, "[,* ]"))
pkg_suggests <- pkg_suggests[pkg_suggests != ""]
cat("Packages listed in Suggests:", paste(pkg_suggests, collapse = ", "), "\n") cat("Packages listed in Suggests:", paste(pkg_suggests, collapse = ", "), "\n")
to_install <- pkg_suggests[!pkg_suggests %in% rownames(utils::installed.packages())] to_install <- pkg_suggests[!pkg_suggests %in% rownames(utils::installed.packages())]
to_update <- as.data.frame(utils::old.packages(repos = "https://cran.rstudio.com/"), stringsAsFactors = FALSE) if (length(to_install) == 0) {
to_update <- to_update[which(to_update$Package %in% pkg_suggests), "Package", drop = TRUE] message("Nothing to install")
}
for (i in seq_len(length(to_install))) { for (i in seq_len(length(to_install))) {
cat("Installing package", to_install[i], "\n") cat("Installing package", to_install[i], "\n")
tryCatch(install.packages(to_install[i], repos = "https://cran.rstudio.com/", dependencies = TRUE, quiet = TRUE), tryCatch(install.packages(to_install[i], repos = "https://cran.rstudio.com/", dependencies = TRUE, quiet = TRUE),
@ -44,6 +42,11 @@ for (i in seq_len(length(to_install))) {
error = function(e) message(e$message)) error = function(e) message(e$message))
} }
to_update <- as.data.frame(utils::old.packages(repos = "https://cran.rstudio.com/"), stringsAsFactors = FALSE)
to_update <- to_update[which(to_update$Package %in% pkg_suggests), "Package", drop = TRUE]
if (length(to_update) == 0) {
message("Nothing to update")
}
for (i in seq_len(length(to_update))) { for (i in seq_len(length(to_update))) {
cat("Updating package", to_update[i], "\n") cat("Updating package", to_update[i], "\n")
tryCatch(update.packages(to_update[i], repos = "https://cran.rstudio.com/", ask = FALSE), tryCatch(update.packages(to_update[i], repos = "https://cran.rstudio.com/", ask = FALSE),

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a> <a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>

View File

@ -39,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>
@ -192,7 +192,7 @@
<div class="page-header toc-ignore"> <div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1> <h1 data-toc-skip>Data sets for download / own use</h1>
<h4 class="date">21 May 2021</h4> <h4 class="date">22 May 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd"><code>vignettes/datasets.Rmd</code></a></small> <small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd"><code>vignettes/datasets.Rmd</code></a></small>
<div class="hidden name"><code>datasets.Rmd</code></div> <div class="hidden name"><code>datasets.Rmd</code></div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>

View File

@ -42,7 +42,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>
@ -236,12 +236,12 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small> <small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div> </div>
<div id="amr-1609056" class="section level1"> <div id="amr-1609058" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9056"> <h1 class="page-header" data-toc-text="1.6.0.9058">
<a href="#amr-1609056" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9056</h1> <a href="#amr-1609058" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9058</h1>
<div id="last-updated-21-may-2021" class="section level2"> <div id="last-updated-22-may-2021" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#last-updated-21-may-2021" class="anchor"></a><small>Last updated: 21 May 2021</small> <a href="#last-updated-22-may-2021" class="anchor"></a><small>Last updated: 22 May 2021</small>
</h2> </h2>
<div id="breaking-change" class="section level3"> <div id="breaking-change" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html datasets: datasets.html
resistance_predict: resistance_predict.html resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html welcome_to_AMR: welcome_to_AMR.html
last_built: 2021-05-21T18:27Z last_built: 2021-05-22T06:56Z
urls: urls:
reference: https://msberends.github.io/AMR//reference reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles article: https://msberends.github.io/AMR//articles

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9056</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9058</span>
</span> </span>
</div> </div>