Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing local repository tests #369

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/testthat/packages/cereal/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: cereal
Type: Package
Version: 2.0.0
Repository: testrepo
License: GPL
Description: Packrat test package
Title: Packrat test package
Author: Anonymous Person <[email protected]>
Maintainer: Anonymous Person <[email protected]>

9 changes: 9 additions & 0 deletions tests/testthat/packages/yogurt/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Package: yogurt
Type: Package
Version: 2.0.0
License: GPL
Description: Packrat test package
Title: Packrat test package
Author: Anonymous Person <[email protected]>
Maintainer: Anonymous Person <[email protected]>

2 changes: 2 additions & 0 deletions tests/testthat/projects/breakfastcereal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packrat/lib*/
packrat/src/
10 changes: 10 additions & 0 deletions tests/testthat/projects/breakfastcereal/packrat/packrat.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PackratFormat: 1.4
PackratVersion: 0.4.8.1
RVersion: 3.3.2
Repos: CRAN=https://mirrors.nics.utk.edu/cran/,
testrepo=file:///home/carendt/r/packrat/tests/testthat/repo

Package: cereal
Source: testrepo
Version: 1.0.0
Hash: f5ddaf46bcdd03014f8daa586a84b69f
1 change: 1 addition & 0 deletions tests/testthat/projects/breakfastyogurt/yogurt.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
library(yogurt)
Binary file not shown.
Binary file not shown.
Binary file not shown.
26 changes: 26 additions & 0 deletions tests/testthat/test-local-repositories.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,30 @@ withTestContext({
})
})

test_that("packrat::restore can load an old version", {
skip('restore cannot load an old local version')

projRoot <- cloneTestProject('breakfastcereal')
repos <- getOption('repos')
options(repos = c(testrepo = paste0("file:///", normalizePath("repo"))))

## Should be no warnings
expect_warning(packrat::restore(projRoot, restart=FALSE), regexp=NA)

options(repos = repos)
})

test_that("packrat can load packages without a repository label", {
skip('packrat requires a repository label')

projRoot <- cloneTestProject('breakfastyogurt')
repos <- getOption('repos')
options(repos = c(testrepo = paste0("file:///", normalizePath("repo"))))

## Should be no warnings
expect_warning(packrat::init(projRoot, enter=FALSE), regexp=NA)

options(repos=repos)
})

})