Skip to content

Commit

Permalink
fix: bunch of corrections on cohort and code
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo committed Aug 18, 2023
1 parent 0719bdd commit 28b2dca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
3 changes: 2 additions & 1 deletion R/deps_installation_proposal.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ new_min_cohort_deps_installation_proposal <- function(path, # nolint
new_refs <- lapply(
refs,
function(x) {
if (inherits(x, "remote_ref_github") && check_if_on_cran(x) && x$commitish == "") {
version <- version_from_desc(x$package, d)
if (inherits(x, "remote_ref_github") && check_if_on_cran(x, version) && x$commitish == "") {
pkgdepends::parse_pkg_ref(x$package)
} else {
x
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ local_description <- function(pkg_list = c(pkgdepends = "Import"),
d_std$set(.desc_field, paste(need_verdepcheck, collapse = ", "))
}

path <- tempfile(pattern = "DESCRIPTION")
path <- tempfile(pattern = "DESCRIPTION-")
d_std$write(path)
withr::defer(unlink(path), envir = .local_envir)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test_proposal_common_bioc <- function(x,
expect_s3_class(x, "pkg_installation_proposal")

# Allows to re-use x accross packages without having to solve it again
if (solve_ip) solve_ip(x)
if (solve_ip_flag) solve_ip(x)

expect_equal(x$get_solution()$status, "OK")

Expand Down
8 changes: 3 additions & 5 deletions tests/testthat/test-deps_installation_proposal.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ test_that("new_min_cohort_deps_installation_proposal correctly handles <org>/<re
skip_if_empty_gh_token()

remote_str <- "r-lib/pkgdepends"
d_std_path <- local_description(
list(pkgdepends = "Import"),
remotes = c(remote_str)
)
d_std_path <- local_description(list(pkgdepends = "Import"), remotes = c(remote_str))
x <- new_min_cohort_deps_installation_proposal(d_std_path)
withr::defer(unlink(x$get_config()$library))

Expand All @@ -151,7 +148,8 @@ test_that("new_min_deps_installation_proposal correctly handles <org>/<repo> ref
desc_str <- "r-lib/pkgdepends"
d_std_path <- local_description(
list(pkgdepends = "Import"),
remotes = c(remote_str), need_verdepcheck = desc_str
remotes = c(remote_str),
need_verdepcheck = desc_str
)
x <- new_min_isolated_deps_installation_proposal(d_std_path)
withr::defer(unlink(x$get_config()$library))
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-desc_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test_that("desc_remotes_cleanup will replace remotes with tag", {
clean_d <- desc_remotes_cleanup(d)

expect_contains(clean_d$get_remotes(), "r-lib/pkgdepends@*release")
expect_contains(clean_d$get_remotes(), "tibble=tidyverse/tibble@v3.2.1")
expect_failure(expect_contains(clean_d$get_remotes(), "tibble=tidyverse/tibble@v3.2.1"))
expect_failure(expect_contains(clean_d$get_remotes(), "tidyverse/dplyr@*release"))
})

Expand Down Expand Up @@ -118,10 +118,10 @@ test_that("desc_remotes_cleanup will not add to remotes", {

clean_d <- desc_remotes_cleanup(d)

expect_length(clean_d$get_remotes(), 2)
expect_length(clean_d$get_remotes(), 1)
expect_contains(clean_d$get_remotes(), "r-lib/pkgdepends@*release")
expect_failure(expect_contains(clean_d$get_remotes(), "tibble=tidyverse/tibble@v3.2.1"))
expect_contains(clean_d$get_remotes(), "tidyverse/dplyr@v1.0.0")
expect_failure(expect_contains(clean_d$get_remotes(), "tidyverse/dplyr@v1.0.0"))
})

test_that("desc_remotes_cleanup accepts no Config/Need/verdepcheck", {
Expand Down

0 comments on commit 28b2dca

Please sign in to comment.