raise a NOTE exception during R CMD check
Asked Answered
B

1

17

Is there any way I could raise my own NOTE exception from within the unit tests in the checking tests ... step of R CMD check?
In general I would like to have a NOTE in 00check.log if database was not available during unit tests.
Dirty solutions welcome.

Update: Actually I see much more use cases for such feature, adding bounty.

Brittnybritton answered 6/2, 2016 at 15:26 Comment(3)
I am not sure you can--you'd need access to the Log object in the environment of the tools package.Link
If you're using testthat, you can use print inside of a testing file. It's not a NOTE, but at least its some output you could check for that isn't going to make the check fail.Mcmillian
You might consider including your own questions before submission with devtools::release(). From the help file: "You can also add arbitrary extra questions by defining an (un-exported) function called release_questions() that returns a character vector of additional questions to ask"Larsen
W
1

Generally tests are run in a separate process. The Log object that Dirk referred to is a local variable in the original process, so there's no way to access it.

Errors in the child process are detected by a non-zero return value. Other anomalies in the test script aren't seen unless you've saved a copy of the desired output; then the comparison of new output with old would see them.

Wellgroomed answered 10/6, 2016 at 11:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.