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

check_installed() doesn't recognize a load_all()'d package as installed #1413

Closed
DavisVaughan opened this issue May 25, 2022 · 5 comments
Closed

Comments

@DavisVaughan
Copy link
Member

DavisVaughan commented May 25, 2022

> rlang::check_installed("hardhat")
> devtools::load_all(".")
ℹ Loading hardhat
> rlang::check_installed("hardhat")
ℹ The package `hardhat` is required.Would you like to install it?

1: Yes
2: No

This comes up in a test for hardhat. I have a create_modeling_package() function that is modeled after usethis, it creates a new package and calls use_package("hardhat", type = "Imports") to set up the description file of that package. use_package() eventually calls check_installed("hardhat") and this is failing in my test for create_modeling_package() now.

@DavisVaughan
Copy link
Member Author

Worth noting that an interactive call to devtools::check() passes, but an interactive call to devtools::test() fails. This makes sense to me, because check() tests the built package in another process and doesn't use load_all(), and test() uses load_all() and tests in the current process.

@DavisVaughan
Copy link
Member Author

DavisVaughan commented May 25, 2022

Oh it is this new commit to fix #1378

5fcde82

The env_is_locked() bit is problematic here (hardhat's env isn't locked while running tests? - I guess because load_all() was used)

@DavisVaughan
Copy link
Member Author

Ah ok so I was surprised that load_all() wasn't sealing the namespace, but it seems like this recent commit in dev pkgload does seal the namespace. r-lib/pkgload@29cc79a

So I think we'd need a pkgload release before the next rlang release for this to be compatible with previous behavior.

# pak::pak(c("r-lib/pkgload", "r-lib/rlang"))

> rlang::is_installed("hardhat")
[1] TRUE
> devtools::load_all(".")
ℹ Loading hardhat
> rlang::is_installed("hardhat")
[1] TRUE

@lionel-
Copy link
Member

lionel- commented May 25, 2022

oh yeah I forgot this was not on CRAN already :(

@lionel-
Copy link
Member

lionel- commented Jun 6, 2022

I've started the release process of pkgload.

@lionel- lionel- closed this as completed Jun 6, 2022
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

No branches or pull requests

2 participants