Closed pwep closed 5 years ago
Check the individual test file in R or RStudio with:
testthat::test_file("tests/testthat/test-compare-3fits.R")
Think I have found the issue. Warnings are being escalated to errors, using option(warn = 2)
. Searching the code for this string shows up an entry here:
https://github.com/dpc10ster/RJafroc/blob/3358e97bf5cfeb3e3e643e2ca41346496036d3f7/R/Compare3ProperRocFits.R#L112
Removing this line and re-loading the package results in warnings for the first write to the tempfile (step 1 in this initial issue comment) but success for the comparison (step 2).
- A generated object is written to a temporary file, if the file is empty
- The object is generated again and compared to the content in the temporary file
The error appears to be a warning.
I have uncommented the example at the top of
test-compare-3fits.R
, to run it, It is the example from the relevant testthat code. That example fails on my version, with the same error as others tests in this file.test-compare-3fits.R:5: error: mtcarsExample - THIS WORKS (converted from warning) Creating reference output 1: expect_known_output(mtcars[1:10, ], tmp, print = TRUE) at /home/peterphillips/repos/RJafroc/tests/testthat/test-compare-3fits.R:5 2: warning("Creating reference output", call. = FALSE) 3: .signalSimpleWarning("Creating reference output", base::quote(NULL)) 4: withRestarts({ .Internal(.signalCondition(simpleWarning(msg, call), msg, call)) .Internal(.dfltWarn(msg, call)) }, muffleWarning = function() NULL) 5: withOneRestart(expr, restarts[[1L]]) 6: doWithOneRestart(return(expr), restart)
The second line indicates that this is a warning, but it has been upgraded to an error. I've found the
testthat
file that generates the warning. I am checking if a default in R has been updated to to escalate all warnings to errors.
mtcars
to run properly on my machine==> Testing R file using 'testthat'
Loading RJafroc Registered S3 methods overwritten by 'ggplot2': method from [.quosures rlang c.quosures rlang print.quosures rlang ✔ | OK F W S | Context ✔ | 2 1 | compare-3fits ────────────────────────────────────────────── test-compare-3fits.R:5: warning: mtcarsExample - THIS WORKS Creating reference output ──────────────────────────────────────────────
Results ══════════════════════════════════════════════ OK: 2 Failed: 0 Warnings: 1 Skipped: 0
Test complete ══════════════════════════════════════════════
I noticed the warning being coerced to error too, but was unable to change the default which happens to be warn = 2
in options()
That would explain why it was working before. Need some way to set warn = 0
. My attempts so far have not been successful, i.e., I tried options(warn = 0)
but after executing the test code, it still has the same value of warn
.
Your next comment resolves the issue. THANK YOU!! That was a debug level warning that got left over (I wanted math underflow errors to be reported in the MLE procedure in Compare3RocFits
).
Think I have found the issue. Warnings are being escalated to errors, using
option(warn = 2)
. Searching the code for this string shows up an entry here:Removing this line and re-loading the package results in warnings for the first write to the tempfile (step 1 in this initial issue comment) but success for the comparison (step 2).
- A generated object is written to a temporary file, if the file is empty
- The object is generated again and compared to the content in the temporary file
The error appears to be a warning.
I have uncommented the example at the top of
test-compare-3fits.R
, to run it, It is the example from the relevant testthat code. That example fails on my version, with the same error as others tests in this file.test-compare-3fits.R:5: error: mtcarsExample - THIS WORKS (converted from warning) Creating reference output 1: expect_known_output(mtcars[1:10, ], tmp, print = TRUE) at /home/peterphillips/repos/RJafroc/tests/testthat/test-compare-3fits.R:5 2: warning("Creating reference output", call. = FALSE) 3: .signalSimpleWarning("Creating reference output", base::quote(NULL)) 4: withRestarts({ .Internal(.signalCondition(simpleWarning(msg, call), msg, call)) .Internal(.dfltWarn(msg, call)) }, muffleWarning = function() NULL) 5: withOneRestart(expr, restarts[[1L]]) 6: doWithOneRestart(return(expr), restart)
The second line indicates that this is a warning, but it has been upgraded to an error. I've found the
testthat
file that generates the warning. I am checking if a default in R has been updated to to escalate all warnings to errors.
Thanks for looking into this. This had been blocking me for several months.
I think we are done with this and am going to close the issue.
The error appears to be a warning.
I have uncommented the example at the top of
test-compare-3fits.R
, to run it, It is the example from the relevant testthat code. That example fails on my version, with the same error as others tests in this file.The second line indicates that this is a warning, but it has been upgraded to an error. I've found the
testthat
file that generates the warning. I am checking if a default in R has been updated to to escalate all warnings to errors.