-
Notifications
You must be signed in to change notification settings - Fork 20
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 helper to skip tests when some pkg is pkgload::load_all()
d
#391
Comments
Are you sure you want to go the package route? I use rhino and don't have to worry about any of this. |
thanks for the kind pointer @asadow; I haven't used rhino/box. This is probably not the right place to discuss the pros/cons of shiny apps inside packages, right? |
@maxheld83 If this worked with your local R package needing to be installed, would you still need this feature? |
@schloerke sorry, not sure I understand. Do you mean:
(emphasis marks correction) Then yes, I would not need this feature, if shinytest2 always used the the same version of testthat (~ I always thought of this as a workaround until #310, so if that's even somewhere on the horizon/still planned, I'd say the (probably marginal) of this workaround/feature does not warrant the extra weight. |
😂 Yes. without. 🤦🤦🤦 I'm hopeful #402 will address this. 🤞 |
I suppose this can be closed then 🙂 |
TL,DR: I have a
skip_if_installed_but_not_via_loadall(x = "my-in-dev-package")
helper, which helps me reduce theload_all()
/installed package confusion: https://github.com/dataheld/elf/blob/main/R/installed.RI'd be happy to contribute it, if you find it useful as a stop-gap until #310 etc.
as I imagine some people who develop shiny apps as functions inside R packages, I kept shooting myself in the foot with this:
(as in, I confuse myself by running tests on the wrong version).
As a stop-gap, I've built myself a set of helpers to automatically skip (shinytest2) tests, whenever the package in question is currently (ie. when running the test) available via
pkgload::load_all()
.This forces me to install the current version and then run
testthat::test_package(package = "mypkg", load_package = 'installed')
.Even if I forget to install,
test_package()
I at least get the tests at the same version as the actual shiny app running.The helpers to detect whether some package is currently
load_all()
d live here:They're just wrappers around
pkgload::is_dev_package()
.The downside is that I have to provide a version of this for every package I built, since I couldn't figure out a way to find that name automatically.
(I also tried automatically figuring out all the used packages in an expression, and then looping over those to skip if any of them where
load_all()
d, but I couldn't make that work).The text was updated successfully, but these errors were encountered: