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

Post about different types of examples #33

Closed
maelle opened this issue Nov 12, 2019 · 13 comments
Closed

Post about different types of examples #33

maelle opened this issue Nov 12, 2019 · 13 comments

Comments

@maelle
Copy link
Member

maelle commented Nov 12, 2019

dontrun, donttest, dontshow, etc.

examples package coverage

https://testthat.r-lib.org/reference/test_examples.html

have a look over the CRAN mirror repos.

maybe a few R-pkg-devel links.

@maelle
Copy link
Member Author

maelle commented Nov 12, 2019

Tip https://twitter.com/WeAreRLadies/status/1064734591641104384?s=19 by Mine CR

Rundontrun in pkgdown

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

dontshow use cases

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

What's run with example() https://github.com/wch/r-source/blob/861905f8c701de8dc673e7c218f808f35d82190a/src/library/utils/R/example.R#L20

run.dontrun = FALSE, run.donttest = interactive()

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

In https://github.com/wch/r-source/blob/06185bd431beb9b6e0883193273d1779ef2c6a2c/src/library/tools/R/testing.R testInstalledPackage calls .createExdotR(pkg, pkgdir, silent = TRUE, ...). By default it comments out dontrun and donttest but this can be toggled.

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

where to store examples (with roxygen2, not necessarily in the R file, probably more natural not to write them with "##" in front)

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

no mention of dontrun/donttest in https://cran.r-project.org/web/packages/policies.html

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

https://stat.ethz.ch/pipermail/r-package-devel/2018q2/002811.html and its answer

"Sure, \dontrun{} markup is intended for cases where neither automated
chercks nor users can expect that the given code work out of the box
and, e.g., changes are needed to make it work, e.g. isertion of otehr
useranmes ... while \donttest{} is expected to work out of the box
(perhaps code that only work interactively or excluded in order to omit
ling running examples from the checks). Nothing new here."

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

@maelle
Copy link
Member Author

maelle commented Jan 7, 2020

works out of the box but long or interactive -> donttest

doesn't work out of the box or doesn't work at all -> dontrun

e.g. to get a subset of the example data -> dontshow

@maelle maelle closed this as completed in c623c2a Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant