Skip to content

Commit

Permalink
fix tests for both usethis 1.4 and the coming 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
gfinak committed Mar 30, 2019
1 parent 9704e06 commit 56af129
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Authors@R:
comment = "Kara reviewed the package for ropensci, see <https://github.com/ropensci/onboarding/issues/230>"),
person("William", "Landau", role = "rev",
comment = "William reviewed the package for ropensci, see <https://github.com/ropensci/onboarding/issues/230>"))
Version: 0.15.6.901
Version: 0.15.6.902
Description: A framework to help construct R data packages in a
reproducible manner. Potentially time consuming processing of
raw data sets into analysis ready data sets is done in a reproducible
Expand Down Expand Up @@ -38,7 +38,7 @@ Imports:
stringr,
futile.logger,
rprojroot,
usethis (>= 1.4.0.900),
usethis,
crayon
VignetteBuilder: knitr
RoxygenNote: 6.1.1
Expand Down
12 changes: 9 additions & 3 deletions R/skeleton.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ datapackage_skeleton <-
path = file.path(path, name),
rstudio = FALSE, open = FALSE
)
usethis::proj_set(package_path)
# compatibility between usethis 1.4 and 1.5.
if(is.character(package_path)){
usethis::proj_set(package_path)
}else{
# create the rest of the necessary elements in the package
# package_path <- file.path(path, name)
package_path <- file.path(path, name)
}
description <-
desc::desc(file = file.path(package_path, "DESCRIPTION"))
description$set("DataVersion" = "0.1.0")
Expand Down Expand Up @@ -196,7 +200,9 @@ datapackage.skeleton <- function(name = NULL,
code_files = code_files,
r_object_names = r_object_names
)
proj_set(proj_path)
if(is.character(proj_path)){
usethis::proj_set(proj_path)
}
}

.done <- function(...) {
Expand Down
3 changes: 1 addition & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"codeRepository": "https://github.com/ropensci/DataPackageR",
"issueTracker": "https://github.com/ropensci/DataPackageR/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.15.6.901",
"version": "0.15.6.902",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -261,7 +261,6 @@
"@type": "SoftwareApplication",
"identifier": "usethis",
"name": "usethis",
"version": ">= 1.4.0.900",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-conditional-build.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ test_that("can add a data item", {
force = TRUE
)
setwd(tempdir())
usethis::proj_set(path = NULL)
try(usethis::proj_set(NULL),silent = TRUE) #wrap in try for usethis 1.4 vs 1.5
})
2 changes: 1 addition & 1 deletion tests/testthat/test-document.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ test_that("documentation is built via document()", {
recursive = TRUE,
force = TRUE
)
usethis::proj_set(path = NULL)
try(usethis::proj_set(NULL),silent = TRUE) #wrap in try for usethis 1.4 vs 1.5
})
2 changes: 1 addition & 1 deletion tests/testthat/test-edge-cases.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ test_that("package built in different edge cases", {
force = TRUE,
recursive = TRUE
)
usethis::proj_set(NULL)
try(usethis::proj_set(NULL),silent = TRUE) #wrap in try for usethis 1.4 vs 1.5
expect_error(DataPackageR:::DataPackageR(file.path(tempdir(), "foo")))
datapackage_skeleton(
name = "subsetCars",
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-project-path.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ unlink(file.path(tempdir(), "subsetCars"),
recursive = TRUE,
force = TRUE
)
usethis::proj_set(path = NULL)
try(usethis::proj_set(path = NULL), silent = TRUE) #compatibility between usethis 1.4 and 1.5

2 changes: 1 addition & 1 deletion tests/testthat/test-r-processing.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ test_that("R file processing works and creates vignettes", {
recursive = TRUE,
force = TRUE
)
usethis::proj_set(NULL)
try(usethis::proj_set(NULL),silent = TRUE) #wrap in try for usethis 1.4 vs 1.5
remove.packages("rfiletest",lib = file.path(tempdir(),"lib"))
})
2 changes: 1 addition & 1 deletion tests/testthat/test-skeleton-data-dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ test_that("data, code, and dependencies are moved into place by skeleton", {
recursive = TRUE,
force = TRUE
)
usethis::proj_set(NULL)
try(usethis::proj_set(NULL),silent = TRUE) #wrap in try for usethis 1.4 vs 1.5
})

0 comments on commit 56af129

Please sign in to comment.