Skip to content

Commit

Permalink
Merge pull request #66 from Microsoft/richcala/R-3.5.0Update
Browse files Browse the repository at this point in the history
Changes for MRO 3.5.0
  • Loading branch information
Rich Calaway authored Jun 6, 2018
2 parents e195080 + 76a7592 commit 8723a8e
Show file tree
Hide file tree
Showing 1,140 changed files with 79,552 additions and 53,640 deletions.
5 changes: 3 additions & 2 deletions additionalPackages/RevoIOQ/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: RevoIOQ
Version: 8.0.10
Version: 10.0.0
Date: 2018-03-28
Title: Microsoft R Services Test Suite
Author: Microsoft Corporation
Expand All @@ -9,4 +9,5 @@ Suggests: RevoUtils
Description: Test suite for Microsoft R Services.
License: GPL-2
Copyright: Copyright Microsoft Corporation
BuildID: 9.4.1.0077
BuildID: 10.0.0.5

3 changes: 2 additions & 1 deletion additionalPackages/RevoIOQ/R/RevoIOQ.R
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,10 @@ runRevoTestSuite <- function(testSuites, useOwnErrorHandler=TRUE, runTestFileInO
save(.testLogger, testFile, testSuite, file=storefile)
testscript <- gsub("\\\\", "/", tempfile(pattern="RevoIOQTest"))
cat("library(RevoIOQ)\n",
if (length(grep("RevoScaleR", testFile)) > 0) "require(RevoScaleR)\n",
if (length(grep("RevoScaleR", testFile)) > 0) "require(RevoScaleR)\n",
"Sys.setlocale('LC_COLLATE', 'C')\n",
paste("load('", storefile, "', envir=.GlobalEnv)\n", sep=""),
"RUnitEnv <- .GlobalEnv\n",
"RNGkind(kind=testSuite$rngKind, normal.kind=testSuite$rngNormalKind)\n",
paste("RUnit:::.sourceTestFile('", testFile,"', '", testSuite$testFuncRegexp, "')\n",sep=""),
paste("save(.testLogger, file='", storefile, "')\n",sep=""), "q('no')\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ options(error=expression())
checkException(delayedAssign(pi, "foo"))
checkException(on.exit(ls(), add=NA_real_))
checkException(on.exit(ls(), add=NA))
checkException(on.exit(1,2,3))
if (compareVersion(paste(R.version$major, R.version$minor, sep="."), "3.5.0") < 0) {
checkException(on.exit(1,2,3))
}
(x <- new.env())
(parent.env(x) <- emptyenv())
checkException(parent.env(x) <- pi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ if (!identical(system.file(package="RevoScaleR") , "")) {
"test.revor.RevoUtilsMath.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoUtilsMath", ver = "10.0.1"))
}
if (!identical(system.file(package="foreach") , "")) {
"test.revoparallelr.foreach.version" <- function() checkTrue("checkPackageVersion"(pkg = "foreach", ver = "1.4.5"))
"test.revoparallelr.iterators.version" <- function() checkTrue("checkPackageVersion"(pkg = "iterators", ver = "1.0.9"))
"test.revoparallelr.foreach.version" <- function() checkTrue("checkPackageVersion"(pkg = "foreach", ver = "1.5.0"))
"test.revoparallelr.iterators.version" <- function() checkTrue("checkPackageVersion"(pkg = "iterators", ver = "1.0.10"))
}
if (!identical(system.file(package="RevoMods"), ""))
{
"test.revor.RevoIOQ.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoIOQ", ver = revover))
"test.revor.RUnit.version" <- function() checkTrue("checkPackageVersion"(pkg = "RUnit", ver = "0.4.26"))
"test.revoparallelr.doParallel.version" <- function() checkTrue("checkPackageVersion"(pkg = "doParallel", ver = "1.0.12"))
"test.revor.RevoUtils.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoUtils", ver = "10.0.9"))
"test.revoparallelr.doParallel.version" <- function() checkTrue("checkPackageVersion"(pkg = "doParallel", ver = "1.0.13"))
"test.revor.RevoUtils.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoUtils", ver = "11.0.0"))
"test.revor.RevoMods.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoMods", ver = "11.0.0"))
} else
{
if (!identical(system.file(package="RevoUtilsMath"),""))
{
"test.revor.RevoUtilsMath.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoUtilsMath", ver = "10.0.1"))
"test.revor.RevoUtilsMath.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoUtilsMath", ver = "11.0.0"))
}
if (!identical(system.file(package="RevoUtils"),""))
{
"test.revor.RevoUtils.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoUtils", ver = "10.0.7"))
"test.revor.RevoUtils.version" <- function() checkTrue("checkPackageVersion"(pkg = "RevoUtils", ver = "11.0.0"))
}
if (!identical(system.file(package="doParallel"),""))
{
"test.revoparallelr.doParallel.version" <- function() checkTrue("checkPackageVersion"(pkg = "doParallel", ver = "1.0.12"))
"test.revoparallelr.doParallel.version" <- function() checkTrue("checkPackageVersion"(pkg = "doParallel", ver = "1.0.13"))
}
}
8 changes: 4 additions & 4 deletions additionalPackages/RevoUtils/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Package: RevoUtils
Version: 10.0.9
Date: 2018-04-15
RevoBuildID: 10.0.9.0125
Version: 11.0.0
Date: 2018-06-07
RevoBuildID: {11.0.0.6}
Title: Microsoft R Utility Package
Author: Microsoft Corporation
Maintainer: Microsoft Corporation <mrspack@microsoft.com>
SystemRequirements: R (>= 3.0.0)
Description: Utility functions for Microsoft R
License: GPL-2
Copyright: Microsoft Corporation
MRANDate: 2018-04-01
MRANDate: 2018-06-01
1 change: 1 addition & 0 deletions additionalPackages/checkpoint/.Renviron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOT_CRAN="true"
13 changes: 8 additions & 5 deletions additionalPackages/checkpoint/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: checkpoint
Title: Install Packages from Snapshots on the Checkpoint Server for
Reproducibility
Reproducibility
Description: The goal of checkpoint is to solve the problem of package
reproducibility in R. Specifically, checkpoint allows you to install packages
as they existed on CRAN on a specific snapshot date as if you had a CRAN time
Expand All @@ -15,10 +15,10 @@ Description: The goal of checkpoint is to solve the problem of package
server (<https://mran.microsoft.com/>). Immediately after completion
of the rsync mirror process, the process takes a snapshot, thus creating the
archive. Snapshot archives exist starting from 2014-09-17.
Version: 0.4.0
Date: 2017-04-10
Version: 0.4.4
Date: 2018-04-09
Author: Microsoft Corporation
Maintainer: Andrie de Vries <adevries@microsoft.com>
Maintainer: Rich Calaway <richcala@microsoft.com>
Copyright: Microsoft
License: GPL-2
URL: https://github.com/RevolutionAnalytics/checkpoint
Expand All @@ -31,7 +31,10 @@ Suggests:
knitr,
rmarkdown,
testthat(>= 0.9),
MASS
MASS,
darts,
mockery,
cli
VignetteBuilder: knitr
RoxygenNote: 6.0.1
Roxygen: list(markdown = TRUE)
1 change: 1 addition & 0 deletions additionalPackages/checkpoint/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export(checkpointRemove)
export(getAccessDate)
export(getValidSnapshots)
export(mranUrl)
export(scanForPackages)
export(setSnapshot)
export(unCheckpoint)
importFrom(utils,Stangle)
Expand Down
11 changes: 6 additions & 5 deletions additionalPackages/checkpoint/R/checkpoint.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ checkpoint <- function(snapshotDate, project = getwd(),
}
}

authorizeFileSystemUse(checkpointLocation)

fixRstudioBug()


# Create checkpoint folders
authorizeFileSystemUse(checkpointLocation)
if(!createFolders(snapshotDate = snapshotDate,
checkpointLocation = checkpointLocation))
stop("Unable to create checkpoint folders at checkpointLocation = \"",
Expand Down Expand Up @@ -152,9 +152,10 @@ checkpoint <- function(snapshotDate, project = getwd(),
if(isTRUE(scanForPackages)){
mssg(verbose, "Scanning for packages used in this project")
pkgs <- scanForPackages(project, use.knitr = use.knitr,
scan.rnw.with.knitr = scan.rnw.with.knitr,
auto.install.knitr = auto.install.knitr
)
scan.rnw.with.knitr = scan.rnw.with.knitr,
auto.install.knitr = auto.install.knitr,
verbose = verbose
)
packages.detected <- pkgs[["pkgs"]]
mssg(verbose, "- Discovered ", length(packages.detected), " packages")

Expand Down
4 changes: 3 additions & 1 deletion additionalPackages/checkpoint/R/checkpoint_internals.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
setMranMirror <- function(
snapshotDate,
snapshotUrl = checkpoint:::getSnapshotUrl(snapshotDate)){
options(repos = snapshotUrl)}
options(repos = snapshotUrl)
}


setLibPaths <- function(checkpointLocation, libPath){
newLoc <- c(libPath,
Expand Down
2 changes: 1 addition & 1 deletion additionalPackages/checkpoint/R/checkpoint_log.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ checkpoint_log <- function(log, snapshotDate, pkg, file = NULL){
)
}
}
}
}
9 changes: 7 additions & 2 deletions additionalPackages/checkpoint/R/checkpoint_paths.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,19 @@ file.path <- function(...){

# If the folder doesn't exists, ask user permission to create it
# The argument interactive is purely for testing purposes
authorizeFileSystemUse <- function(checkpointLocation, interactive = interactive()) {
authorizeFileSystemUse <- function(checkpointLocation = "~/",
interactive) {
if (missing(interactive)){
isInteractive <- base::interactive()
interactive <- isInteractive
}
checkpointRoot = file.path(checkpointLocation, ".checkpoint")
if(file.exists(checkpointRoot)) {
if(!file.info(checkpointRoot)$isdir)
stop("Can't use a non-directory as checkpoint root")}
else {
if(interactive) {
message("Can I create directory", checkpointRoot, "for internal checkpoint use?\n")
message("Can I create directory ", checkpointRoot, " for internal checkpoint use?\n")
answer = readline("Continue (y/n)? ")
if(tolower(answer) != "y")
stop("Cannot proceed without access to checkpoint directory")}
Expand Down
14 changes: 11 additions & 3 deletions additionalPackages/checkpoint/R/scanRepoPackages.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ projectScanPackages <- function(...){
scanForPackages(...)
}

#' Scans a project (or folder) for references to packages.
#'
#' @inheritParams checkpoint
#' @return A list with two elements:
#' * pkgs: a character vector with the names of identified packages
#' * error: a character vector with information about files that could not be parsed
#' @export
scanForPackages <- function(project = getwd(), verbose = TRUE,
use.knitr = FALSE,
auto.install.knitr = FALSE,
scan.rnw.with.knitr = FALSE){
use.knitr = FALSE,
auto.install.knitr = FALSE,
scan.rnw.with.knitr = FALSE
){
# detect all package dependencies for a project
dir <- normalizePath(project, winslash='/', mustWork=FALSE)
pattern <- if(!use.knitr) "\\.[rR]$|\\.[rR]nw$" else
Expand Down
30 changes: 30 additions & 0 deletions additionalPackages/checkpoint/man/scanForPackages.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions additionalPackages/checkpoint/tests/test-all.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library(cli)
library(testthat)
old.env <- Sys.getenv("checkpoint.mock.install")
Sys.setenv("checkpoint.mock.install" = TRUE)
Expand Down
46 changes: 34 additions & 12 deletions additionalPackages/checkpoint/tests/testthat/test-0-is-404.R
Original file line number Diff line number Diff line change
@@ -1,31 +1,53 @@
if(interactive()) library(testthat)
library(mockery)

context("is.404")

test_that("is.404", {
skip_if_offline()
expect_true(is.404("http://mran.microsoft.com/snapshot/1972-01-01", warn = FALSE))
expect_false(is.404("http://mran.microsoft.com/snapshot"))
expect_false(is.404("http://mran.microsoft.com/snapshot/2015-05-01"))
skip_on_cran()
expect_true(
is.404("http://mran.microsoft.com/snapshot/1972-01-01", warn = FALSE)
)
expect_false(
is.404("http://mran.microsoft.com/snapshot")
)
expect_false(
is.404("http://mran.microsoft.com/snapshot/2015-05-01")
)
})

test_that("is.404 works with https", {

if(!httpsSupported()) skip("https not supported")
expect_true(suppressWarnings(is.404("https://mran.microsoft.com/snapshot/1972-01-01")))
expect_false(is.404("https://mran.microsoft.com/snapshot"))
expect_false(is.404("https://mran.microsoft.com/snapshot/2015-05-01"))
expect_true(
suppressWarnings(is.404("https://mran.microsoft.com/snapshot/1972-01-01"))
)
expect_false(
is.404("https://mran.microsoft.com/snapshot")
)
expect_false(
is.404("https://mran.microsoft.com/snapshot/2015-05-01")
)

})

test_that("is.404 gracefully deals with https URLs when https not supported", {

with_mock(`checkpoint:::httpsSupported` = function(mran) FALSE, {
# if(!httpsSupported()) skip("https not supported")
expect_true(is.404("https://mran.microsoft.com/snapshot/1972-01-01", warn = FALSE))
expect_true(is.404("https://mran.microsoft.com/snapshot", warn = FALSE))
expect_true(is.404("https://mran.microsoft.com/snapshot/2015-05-01", warn = FALSE))
})
stub(is.404, "httpsSupported", function(mran) FALSE)
expect_true(
is.404("https://mran.microsoft.com/snapshot/1972-01-01", warn = FALSE)
)

# stub(is.404, "httpsSupported", function(mran) FALSE)
expect_true(
is.404("https://mran.microsoft.com/snapshot", warn = FALSE)
)

# stub(is.404, "httpsSupported", function(mran) FALSE)
expect_true(
is.404("https://mran.microsoft.com/snapshot/2015-05-01", warn = FALSE)
)

})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
if(interactive()) library("testthat")
library(mockery)
context("getValidSnapshots finds valid dates")


Expand Down Expand Up @@ -26,16 +27,17 @@ test_that("suggests a reasonable alternative", {
})

test_that("works with no network connection", {
with_mock(`getValidSnapshots` = function(...){x <- character(0); class(x) = "error"; x}, {
expect_message(stopIfInvalidDate("2015-06-05"),
"Unable to connect to MRAN. Skipping some date validations."
)
with_mock(`getValidSnapshots` = function(...){x <- character(0); class(x) = "error"; x}, {
expect_message(stopIfInvalidDate("2015-06-05"),
"Unable to connect to MRAN. Skipping some date validations."
)
})
})
stub(stopIfInvalidDate, "getValidSnapshots",
function(...){x <- character(0); class(x) = "error"; x}
)
expect_message(
stopIfInvalidDate("2015-06-05"),
"Unable to connect to MRAN. Skipping some date validations."
)
expect_message(
stopIfInvalidDate("2015-06-05"),
"Unable to connect to MRAN. Skipping some date validations."
)
})

test_that("works on local file", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ test.start <- switch(current.R,
"3.1" = "2014-10-01",
"3.2" = "2015-05-01",
"3.3" = "2016-04-01",
"2016-04-01"
"3.4" = "2017-04-24",
"2017-04-24"
)

MRAN.default = test.start[1] # ensure only a single value
Expand Down
Loading

0 comments on commit 8723a8e

Please sign in to comment.