dpc10ster / RJafroc

Artificial Intelligence: Evaluating AI, optimizing AI
19 stars 8 forks source link

test-compare-3fits.R testthat errors #6

Closed pwep closed 5 years ago

pwep commented 5 years ago
  1. A generated object is written to a temporary file, if the file is empty
  2. 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.

pwep commented 5 years ago

Check the individual test file in R or RStudio with:

testthat::test_file("tests/testthat/test-compare-3fits.R")
pwep commented 5 years ago

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).

dpc10ster commented 5 years ago
  1. A generated object is written to a temporary file, if the file is empty
  2. 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.

==> 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 ══════════════════════════════════════════════

dpc10ster commented 5 years ago

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).

THANK YOU

dpc10ster commented 5 years ago
  1. A generated object is written to a temporary file, if the file is empty
  2. 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.

You rock!

dpc10ster commented 5 years ago

I think we are done with this and am going to close the issue.