Skip to content

Commit 6c04a2b

Browse files
committed
Started on R CMD CHECK
1 parent fbeafe2 commit 6c04a2b

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ Imports:
1212
utils,
1313
tools,
1414
devtools,
15-
methods
15+
methods,
16+
testthat,
17+
covr
1618
LinkingTo: Rcpp
1719
Suggests:
18-
testthat,
19-
covr,
2020
parallel,
2121
knitr,
2222
rmarkdown,

R/testr.R

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ testr_addRegression <- function(package.dir = ".", code, functions, filter = TRU
1717
cleanup = F
1818
# stop all ongoing captures
1919
stop_capture_all()
20-
library(devtools, quietly = T)
21-
library(tools, quietly = T)
2220
if (build) {
2321
if (verbose)
2422
cat(paste("Building package", package.dir, "\n"))
@@ -34,8 +32,9 @@ testr_addRegression <- function(package.dir = ".", code, functions, filter = TRU
3432
#devtools:::install(package.name, quiet = T)
3533
install.packages(package.path, repos = NULL, quiet = T, type = "source")
3634
# get list of all functions
37-
package = devtools:::as.package(package.dir)
38-
library(package = package$package, character.only = T)
35+
package = devtools::as.package(package.dir)
36+
# TODO I don't thing this line is needed anymore
37+
# library(package = package$package, character.only = T)
3938
if (verbose)
4039
cat(paste("Package", package$package, "installed\n"))
4140
# if function names were not specified,
@@ -97,7 +96,7 @@ testr_addRegression <- function(package.dir = ".", code, functions, filter = TRU
9796
#' @export
9897
#'
9998
testr_package <- function(package.dir = ".", include.tests = FALSE, timed = FALSE, filter = TRUE, build = TRUE, output, verbose = testr_options("verbose")) {
100-
package = devtools:::as.package(package.dir)
99+
package = devtools::as.package(package.dir)
101100
f <- function() {
102101
# run package examples
103102
files <- devtools:::rd_files(package)
@@ -106,7 +105,7 @@ testr_package <- function(package.dir = ".", include.tests = FALSE, timed = FALS
106105
if (length(files) != 0)
107106
tryCatch(lapply(files, devtools:::run_example), error=function(x) print(x))
108107
# run package vignettes
109-
info <- tools:::getVignetteInfo(package = package$package)
108+
info <- tools::getVignetteInfo(package = package$package)
110109
vdir <- info[,2]
111110
vfiles <- info[,6]
112111
p <- file.path(vdir, "doc", vfiles)
@@ -117,7 +116,6 @@ testr_package <- function(package.dir = ".", include.tests = FALSE, timed = FALS
117116
if (include.tests) {
118117
if (verbose)
119118
cat("Running package tests\n")
120-
library(testthat, quietly = T)
121119
testthat:::run_tests(package.name)
122120
}
123121
}
@@ -259,7 +257,6 @@ run <- function(test_dir, verbose = testr_options("verbose")) {
259257
}
260258
result = TRUE
261259
# now we have the directory in which the tests are located, run testthat on them
262-
library(testthat, quietly = TRUE)
263260
# for all folders in the file
264261
dirs <- list.files(test_dir, include.dirs = T, no.. = T)
265262
for (d in dirs) {
@@ -440,7 +437,6 @@ run_tests <- function(loc) {
440437
test_path <- find_tests(loc)
441438
if (is.null(test_path))
442439
return(invisible())
443-
library(testthat, quietly = TRUE)
444440
tryCatch(testthat::test_dir(test_path), error=function(x) invisible())
445441
}
446442

0 commit comments

Comments
 (0)