@@ -17,8 +17,6 @@ testr_addRegression <- function(package.dir = ".", code, functions, filter = TRU
17
17
cleanup = F
18
18
# stop all ongoing captures
19
19
stop_capture_all()
20
- library(devtools , quietly = T )
21
- library(tools , quietly = T )
22
20
if (build ) {
23
21
if (verbose )
24
22
cat(paste(" Building package" , package.dir , " \n " ))
@@ -34,8 +32,9 @@ testr_addRegression <- function(package.dir = ".", code, functions, filter = TRU
34
32
# devtools:::install(package.name, quiet = T)
35
33
install.packages(package.path , repos = NULL , quiet = T , type = " source" )
36
34
# 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)
39
38
if (verbose )
40
39
cat(paste(" Package" , package $ package , " installed\n " ))
41
40
# if function names were not specified,
@@ -97,7 +96,7 @@ testr_addRegression <- function(package.dir = ".", code, functions, filter = TRU
97
96
# ' @export
98
97
# '
99
98
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 )
101
100
f <- function () {
102
101
# run package examples
103
102
files <- devtools ::: rd_files(package )
@@ -106,7 +105,7 @@ testr_package <- function(package.dir = ".", include.tests = FALSE, timed = FALS
106
105
if (length(files ) != 0 )
107
106
tryCatch(lapply(files , devtools ::: run_example ), error = function (x ) print(x ))
108
107
# run package vignettes
109
- info <- tools ::: getVignetteInfo(package = package $ package )
108
+ info <- tools :: getVignetteInfo(package = package $ package )
110
109
vdir <- info [,2 ]
111
110
vfiles <- info [,6 ]
112
111
p <- file.path(vdir , " doc" , vfiles )
@@ -117,7 +116,6 @@ testr_package <- function(package.dir = ".", include.tests = FALSE, timed = FALS
117
116
if (include.tests ) {
118
117
if (verbose )
119
118
cat(" Running package tests\n " )
120
- library(testthat , quietly = T )
121
119
testthat ::: run_tests(package.name )
122
120
}
123
121
}
@@ -259,7 +257,6 @@ run <- function(test_dir, verbose = testr_options("verbose")) {
259
257
}
260
258
result = TRUE
261
259
# now we have the directory in which the tests are located, run testthat on them
262
- library(testthat , quietly = TRUE )
263
260
# for all folders in the file
264
261
dirs <- list.files(test_dir , include.dirs = T , no.. = T )
265
262
for (d in dirs ) {
@@ -440,7 +437,6 @@ run_tests <- function(loc) {
440
437
test_path <- find_tests(loc )
441
438
if (is.null(test_path ))
442
439
return (invisible ())
443
- library(testthat , quietly = TRUE )
444
440
tryCatch(testthat :: test_dir(test_path ), error = function (x ) invisible ())
445
441
}
446
442
0 commit comments