Skip to content

Commit

Permalink
fixed test_all errors (#25, #28, #29)
Browse files Browse the repository at this point in the history
added missing repos as needed
  • Loading branch information
achubaty committed Nov 18, 2014
1 parent 35cb2be commit afa4865
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion R/addPackages.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ addOldPackage <- function(pkgs=NULL, path=NULL, vers=NULL,
pkgPath <- file.path(path=path, repoPrefix(type, R.version))
if(!file.exists(pkgPath)) dir.create(pkgPath, recursive=TRUE)
sapply(oldPkgs, function(x) {
download.file(x, destfile=file.path(pkgPath, basename(x)))
result <- download.file(x, destfile=file.path(pkgPath, basename(x)), method="auto")
if(result!=0) warning("error downloading file ", x)
})
if (writePACKAGES) tools::write_PACKAGES(dir=pkgPath, type=type)
}
2 changes: 1 addition & 1 deletion R/updatePackages.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,6 @@ updatePackages <- function (path=NULL, repos=getOption("repos"),
oldPkgs
}
if (length(update[,"Package"])) {
addPackage(update[,"Package"], path=path, type=type)
addPackage(update[,"Package"], path=path, repos=repos, type=type)
}
}
12 changes: 8 additions & 4 deletions tests/testthat/test-5-addOldPackage.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ test_that("addOldPackage downloads source files and builds PACKAGES file", {
oldVers <- data.frame(package=c("foreach", "codetools", "iterators"),
version=c("1.4.0", "0.2-7", "1.0.5"),
stringsAsFactors=FALSE)
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"], type=pkg_type)
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"],
repos=revolution, type=pkg_type)

dlVers <- miniCRAN:::getPkgVersFromFile(list.files(file.path(repo_root, prefix)))

Expand Down Expand Up @@ -69,7 +70,8 @@ test_that("addOldPackage downloads windows binary files and builds PACKAGES file
stringsAsFactors=FALSE)

expect_error(
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"], type=pkg_type)
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"],
repos=revolution, type=pkg_type)
)

unlink(repo_root, recursive=TRUE)
Expand All @@ -94,7 +96,8 @@ test_that("addOldPackage downloads mac binary files and builds PACKAGES file", {
version=c("1.4.0", "0.2-7", "1.0.5"))

expect_error(
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"], type=pkg_type)
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"],
repos=revolution, type=pkg_type)
)

unlink(repo_root, recursive=TRUE)
Expand All @@ -118,7 +121,8 @@ test_that("addOldPackage downloads mac binary files and builds PACKAGES file", {
# stringsAsFactors=FALSE)
#
# expect_error(
# addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"], type=pkg_type)
# addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"],
# repos=revolution, type=pkg_type)
# )
#
# unlink(repo_root, recursive=TRUE)
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-6-checkVersions.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ test_that("checkVersions downloads old and current source files checks for these
oldVers <- data.frame(package=c("foreach", "codetools", "iterators"),
version=c("1.4.0", "0.2-7", "1.0.5"),
stringsAsFactors=FALSE)
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"], type=pkg_type)
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"],
repos=revolution, type=pkg_type)
makeRepo(pkgList, path=repo_root, repos=revolution, type=pkg_type, writePACKAGES=FALSE)

files <- suppressWarnings(checkVersions(pkgList, path=repo_root, type=pkg_type))
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-7-updatePackages.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ test_that("updatePackages downloads source files and builds PACKAGES file", {
oldVers <- data.frame(package=c("foreach", "codetools", "iterators"),
version=c("1.4.0", "0.2-7", "1.0.5"),
stringsAsFactors=FALSE)
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"], type=pkg_type)
addOldPackage(pkgList, path=repo_root, vers=oldVers[,"version"],
repos=revolution, type=pkg_type)
suppressWarnings(updatePackages(path=repo_root, repos=revolution, type=pkg_type, ask=FALSE))

updateVers <- miniCRAN:::getPkgVersFromFile(list.files(file.path(repo_root, prefix)))
Expand Down

0 comments on commit afa4865

Please sign in to comment.