nealrichardson / httptest2

Utilities for testing R 📦s that use httr2
https://enpiar.com/httptest2/
Other
26 stars 6 forks source link

`README` mock files with no files in 'inst/doc' trigger `R CMD check` warning #33

Open asadow opened 7 months ago

asadow commented 7 months ago

I have the following warning from R CMD check. I wonder whether this is due to having no vignettes. I do have an article which uses start/end_vignette(), however.

Would a link to a repo help diagnose the issue?

❯ checking files in 'vignettes' ... WARNING
  Files in the 'vignettes' directory but no files in 'inst/doc':
    'README/0/status-b4ea5e.R' <more-files>
nealrichardson commented 7 months ago

Would a link to a repo help diagnose the issue?

Probably so.

start_vignette() will try to put things in the vignettes directory, if it exists: https://github.com/nealrichardson/httptest2/blob/main/R/vignette.R#L49-L53

I'm not sure how you're building a non-vignette article, but IIUC if you're running the process from some path where there is no "vignettes" subdirectory, it won't write mocks inside vignettes/.

asadow commented 7 months ago

After further investigation, I see usethis::use_article() will create a vignettes/articles/ folder. Then usethis::build_readme() will write the README mocks inside vignettes/README/. Without a vignettes/ folder, usethis::build_readme() writes README mocks at README/.

I wonder if the CMD check fails because of .R files in vignettes/, when there are only articles in vignettes/.

My repo is https://github.com/asadow/megamation. It passes CMD check after removing vignettes and writing mocks at README/.

nealrichardson commented 2 months ago

Sorry for the delay, I somehow missed your reply.

If I understand, it sounds like you're trying to use httptest2::start_vignette() to mock stuff in your README.Rmd, and it seems that's not supported. OTOH I'm not sure how to make that work robustly. Open to suggestions.