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

Fix bugs involving roxygen2::roxygenise() attaching the target package to the search path #107

Merged
merged 6 commits into from Apr 12, 2024

Conversation

slager
Copy link
Contributor

@slager slager commented Apr 1, 2024

roxygen2::roxygenise() has the not-so-obvious side-effect of attaching the package that is being roxygenized, and leaving it attached on exit, even if it wasn't attached before.

This caused warnings to be thrown during the building of README.Rmd. The warnings came from DataPackageR::package_build() and DataPackageR::document(), which use roxygen2::roxygenise() directly or indirectly via devtools::document(), respectively, and from install.packages() warning that the package was already attached.

In this PR:

  • Fixed these bugs safely by ensuring the packages will be unloaded via on.exit() regardless of whether install = TRUE or install = FALSE.

  • Added tests to verify the intended behavior. The tests error out on develop and pass when cherry-picked to this PR branch.

  • Edited README.Rmd to not install the mtcars20 package multiple times, and rebuilt the relevant section of README.md.

@slager slager changed the title Fix bugs involving roxygen2::roxygenise() leaving the target package attached to the search path Fix bugs involving roxygen2::roxygenise() attaching the target package to the search path Apr 1, 2024
@slager
Copy link
Contributor Author

slager commented Apr 1, 2024

Also tested rebuilding a real data package I've been working with (Schief546). Works as expected.

@slager
Copy link
Contributor Author

slager commented Apr 1, 2024

Added 1 more tweak, done updating.

@slager slager removed the request for review from jmtaylor-fhcrc April 12, 2024 04:54
@slager slager merged commit 78dbd04 into develop Apr 12, 2024
9 checks passed
@slager slager deleted the phantom_load_bugfix branch April 12, 2024 04:55
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.

None yet

1 participant