Skip to content

test(renv): read lockfiles with renv::lockfile_read() for renv >= 1.2.4 - #142

Open
VincentGuyader wants to merge 1 commit into
mainfrom
fix-renv-1.2.4-lockfile
Open

test(renv): read lockfiles with renv::lockfile_read() for renv >= 1.2.4#142
VincentGuyader wants to merge 1 commit into
mainfrom
fix-renv-1.2.4-lockfile

Conversation

@VincentGuyader

Copy link
Copy Markdown
Member

Problem

CI R CMD check fails on ubuntu/macos (release + oldrel) with:

Error: don't know how to create a lockfile from an object of class 'list'

main itself is affected: its last green CI run predates the current renv release. This is a renv version incompatibility, not a code regression, and it is unrelated to any package source change.

Root cause

The NOT_CRAN-gated renv tests read a generated lockfile back through the internal renv:::lockfile(path) API. In renv 1.2.4 that entry point only accepts a manifest and errors on a normal lockfile, raising the message above at test-renv_create.R:128. Package source (R/create_renv.R) is unaffected: it only writes lockfiles via the exported renv::snapshot(), which works fine on 1.2.4.

Because these tests are skip_on_cran(), the CRAN incoming check and win-builder are unaffected (both are 0/0/0); only the full CI check surfaces it.

Fix

Test-only. Read lockfiles through the exported, stable renv::lockfile_read(), available since well before renv 1.2.2, which returns a renv_lockfile object exposing $Packages directly. Three mechanical replacements across the two renv test files:

  • getFromNamespace("lockfile", "renv")(x) -> renv::lockfile_read(x)
  • expect_s3_class(y, "renv_lockfile_api") -> expect_s3_class(y, "renv_lockfile")
  • z$data()$Packages -> z$Packages

Verification

  • Full test suite green under both renv 1.2.2 and 1.2.4 (86 tests, 0 failed, 0 error, 1 skipped).
  • Red captured first under 1.2.4 (exact CI error), then green after the fix.
  • No leftover old-API usages in tests/ or R/; no source change.

No NEWS entry: test-infrastructure only, not user-facing, and these tests are skip_on_cran().

The renv tests read back generated lockfiles through the internal
renv:::lockfile() path, which in renv 1.2.4 only accepts a manifest and
errors on a lockfile with "don't know how to create a lockfile from an
object of class 'list'". Switch to the exported renv::lockfile_read(),
available and stable since well before 1.2.2, which returns a
renv_lockfile object exposing $Packages directly. Package code is
unaffected; this only touches the NOT_CRAN-gated renv tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant