devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Add dev_example() to documentation for run_examples()

Open orgadish opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. When developing my package examples, I often want to test only one file's examples. Using run_examples(start="my_file") is insufficient, since I have little control over what comes after so I have to scroll up to see what I actually want.

~~It looks like this was implemented at some point (#108), but I can't find it anymore (at least in version 2.4.5).~~ ~~If there is a way to do this with run_examples(), I recommend highlighting that in the help documentation.~~

Describe the solution you'd like A function like run_example() which runs one file's example.

Update 01/21/2024

Such a function exists! It's just in the pkgload package, which is not where I would have expected to look for it, since a) run_examples() is in devtools and b) run_example() doesn't have to do with "simulating the process of installing and loading a package" in my mind.

Given that the function(s) already exist, but are perhaps not easy to find, this request is to do one or both of the following:

  1. Reference dev_example() / run_example() in the docs for devtools::run_examples()
  2. Move dev_example() / run_example() to devtools.

orgadish avatar Nov 08 '23 19:11 orgadish

Looks like this exists as pkgload::dev_example(), so the ask is to add this to the run_examples documentation and/or export dev_example() as part of devtools.

orgadish avatar Nov 08 '23 19:11 orgadish

I was having a similar issue and I have found out pkgload::run_example(). Does that help?

pawelru avatar Jan 19 '24 10:01 pawelru

@pawelru I think the better alternative for me is pkgload::dev_example() which allows you pass in the topic/name rather than the full path.

Since this function already exists, I think the need is just to reference this function in the devtools::run_examples() documentation so that we even know this exists (since most of us use devtools to do most of our package building, rather than dealing with the separate underlying packages. I will update the request title and description accordingly.

orgadish avatar Jan 22 '24 04:01 orgadish