Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAxthelm committed Apr 8, 2024
1 parent 50c8ee3 commit 0a2889a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/helper-remote_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ remote_package <- list(
name = "minimal.r.package",
version = "0.0.0.9001",
old_version = "0.0.0.9000",
gh_repo = "RMI-PACTA/minimal.r.package",
gh_repo_old = "RMI-PACTA/minimal.r.package@28c716f",
gh_repo = "RMI-PACTA/minimal.r.package", #nolint: nonportable_path_linter
gh_repo_old = "RMI-PACTA/minimal.r.package@28c716f", #nolint: nonportable_path_linter
branch = "main",
upstream = "refs/remotes/origin/main",
upstream = "refs/remotes/origin/main", #nolint: nonportable_path_linter
url = "https://github.com/RMI-PACTA/minimal.r.package.git",
sha = "f31fa0e5675b675fb778e15fcf1501aecec8cf94",
old_sha = "28c716face8bbf8787c32ae392f246177f111c00"
Expand Down
38 changes: 20 additions & 18 deletions tests/testthat/test-get_individual_package_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ expect_package_info <- function(
} else {
testthat::expect_in(
object = package_info[["library"]],
.libPaths() #nolint: undesirable_function_linter
.libPaths() # nolint: undesirable_function_linter
)
testthat::expect_gt(
object = package_info[["library_index"]],
expected = 0L
)
testthat::expect_lte(
object = package_info[["library_index"]],
expected = length(.libPaths()) #nolint: undesirable_function_linter
expected = length(.libPaths()) # nolint: undesirable_function_linter
)
testthat::expect_match(
object = package_info[["platform"]],
Expand All @@ -91,7 +91,7 @@ expect_package_info <- function(

testthat::expect_identical(
object = package_info[["library"]],
expected = .libPaths()[package_info[["library_index"]]] #nolint: undesirable_function_linter
expected = .libPaths()[package_info[["library_index"]]] # nolint: undesirable_function_linter
)
testthat::expect_type(
object = package_info[["library_index"]],
Expand Down Expand Up @@ -198,7 +198,7 @@ test_that("get_individual_package_info collects information for local packages c
testthat::skip_if_offline()
dest_dir <- normalizePath(withr::local_tempdir())
dl <- gert::git_clone(
url = remote_package[["url"]], #nolint: nonportable_path_linter
url = remote_package[["url"]],
path = dest_dir,
verbose = FALSE
)
Expand All @@ -222,7 +222,7 @@ test_that("get_individual_package_info collects information for local packages c
branch = list(
name = remote_package[["branch"]],
commit = remote_package[["sha"]],
upstream = remote_package[["upstream"]], #nolint: nonportable_path_linter
upstream = remote_package[["upstream"]],
remote_url = remote_package[["url"]],
up_to_date = TRUE,
upstream_commit = remote_package[["sha"]]
Expand All @@ -242,15 +242,15 @@ test_that("get_individual_package_info collects information for GitHub packages
testthat::skip_on_cran()
testthat::skip_if_offline()
new_lib <- normalizePath(withr::local_tempdir())
package_info <- with_local_install(new_lib, remote_package[["gh_repo"]], { #nolint: nonportable_path_linter
package_info <- with_local_install(new_lib, remote_package[["gh_repo"]], {
package_info <- get_individual_package_info(remote_package[["name"]])
expect_package_info(
package_info,
package_identical = remote_package[["name"]],
version_identical = remote_package[["version"]],
repository_match = NA_character_,
remotetype_identical = "github",
remotepkgref_match = paste0("^", remote_package[["gh_repo"]], "$"), #nolint: nonportable_path_linter
remotepkgref_match = paste0("^", remote_package[["gh_repo"]], "$"),
remoteref_identical = "HEAD",
remotesha_identical = remote_package[["sha"]]
)
Expand All @@ -267,7 +267,7 @@ test_that("get_individual_package_info collects information for packages loaded
testthat::skip_if_not_installed("pkgload")
dest_dir <- normalizePath(withr::local_tempdir())
dl <- gert::git_clone(
url = remote_package[["url"]], #nolint: nonportable_path_linter
url = remote_package[["url"]],
path = dest_dir,
verbose = FALSE
)
Expand Down Expand Up @@ -296,7 +296,7 @@ test_that("get_individual_package_info collects information for packages loaded
branch = list(
name = remote_package[["branch"]],
commit = remote_package[["sha"]],
upstream = remote_package[["upstream"]], #nolint: nonportable_path_linter
upstream = remote_package[["upstream"]],
remote_url = remote_package[["url"]],
up_to_date = TRUE,
upstream_commit = remote_package[["sha"]]
Expand All @@ -320,7 +320,7 @@ test_that("get_individual_package_info collects information for packages loaded
testthat::skip_if_not_installed("devtools")
dest_dir <- normalizePath(withr::local_tempdir())
dl <- gert::git_clone(
url = remote_package[["url"]], #nolint: nonportable_path_linter
url = remote_package[["url"]],
path = dest_dir,
verbose = FALSE
)
Expand Down Expand Up @@ -349,7 +349,7 @@ test_that("get_individual_package_info collects information for packages loaded
branch = list(
name = remote_package[["branch"]],
commit = remote_package[["sha"]],
upstream = remote_package[["upstream"]], #nolint: nonportable_path_linter
upstream = remote_package[["upstream"]],
remote_url = remote_package[["url"]],
up_to_date = TRUE,
upstream_commit = remote_package[["sha"]]
Expand All @@ -373,7 +373,7 @@ test_that("get_individual_package_info collects information for altered packages
testthat::skip_if_not_installed("devtools")
dest_dir <- normalizePath(withr::local_tempdir())
dl <- gert::git_clone(
url = remote_package[["url"]], #nolint: nonportable_path_linter
url = remote_package[["url"]],
path = dest_dir,
verbose = FALSE
)
Expand Down Expand Up @@ -408,7 +408,7 @@ test_that("get_individual_package_info collects information for altered packages
branch = list(
name = remote_package[["branch"]],
commit = commit_sha,
upstream = remote_package[["upstream"]], #nolint: nonportable_path_linter
upstream = remote_package[["upstream"]],
remote_url = remote_package[["url"]],
up_to_date = FALSE,
upstream_commit = remote_package[["sha"]]
Expand Down Expand Up @@ -459,16 +459,18 @@ test_that("get_individual_package_info gets correct libpath and version of multi
new_lib <- normalizePath(withr::local_tempdir())
newer_lib <- normalizePath(withr::local_tempdir())
expect_warning(
with_local_install(new_lib, remote_package[["gh_repo"]], { #nolint: nonportable_path_linter
with_local_install(newer_lib, remote_package[["gh_repo_old"]], { #nolint: nonportable_path_linter
with_local_install(new_lib, remote_package[["gh_repo"]], {
with_local_install(newer_lib, remote_package[["gh_repo_old"]], {
package_info <- get_individual_package_info(remote_package[["name"]])
expect_package_info(
package_info,
package_identical = remote_package[["name"]],
version_identical = remote_package[["old_version"]],
repository_match = NA_character_,
remotetype_identical = "github",
remotepkgref_match = paste0("^", remote_package[["gh_repo_old"]], "$"),
remotepkgref_match = paste0(
"^", remote_package[["gh_repo_old"]], "$"
),
remoteref_identical = "28c716f",
remotesha_identical = remote_package[["old_sha"]]
)
Expand All @@ -490,7 +492,7 @@ test_that("get_individual_package_info gets correct libpath for lower search pri
testthat::skip_if_offline()
new_lib <- normalizePath(withr::local_tempdir())
newer_lib <- normalizePath(withr::local_tempdir())
with_local_install(new_lib, remote_package[["gh_repo"]], { #nolint: nonportable_path_linter
with_local_install(new_lib, remote_package[["gh_repo"]], {
with_local_install(newer_lib, "digest", {
package_info <- get_individual_package_info(remote_package[["name"]])
expect_package_info(
Expand All @@ -499,7 +501,7 @@ test_that("get_individual_package_info gets correct libpath for lower search pri
version_identical = remote_package[["version"]],
repository_match = NA_character_,
remotetype_identical = "github",
remotepkgref_match = paste0("^", remote_package[["gh_repo"]], "$"), #nolint: nonportable_path_linter
remotepkgref_match = paste0("^", remote_package[["gh_repo"]], "$"),
remoteref_identical = "HEAD",
remotesha_identical = remote_package[["sha"]]
)
Expand Down

0 comments on commit 0a2889a

Please sign in to comment.