testthat icon indicating copy to clipboard operation
testthat copied to clipboard

Minimize output noise when R has no NLS support

Open dgkf opened this issue 3 years ago • 1 comments

Closes #1566

A pretty minor change to implement the suggested changes in #1566.

I made one additional design choice to emit a once-per-session warning when local_reproducible_output is run without NLS, but I'm not sure exactly what the best behavior would be. I could see the argument either way - either as a good reminder that the tests may still fail on another system, or as an unfortunate state-dependent test result. I would have no problem removing it if reproducibility of test result warnings is the more important behavior.

When run without NLS capability, the first test to check against local_reproducible_output will emit a warning:

───────────────────────────────────────────────────────────
Warning (test-base.R:1:1): (code run outside of `test_that()`)
Local reproducible output can't be checked fully because R is installed without NLS
This warning is displayed once per session.
Backtrace:
 1. testthat::test_that(...)
      at test-base.R:1:0
 2. testthat::local_test_context()
      at testthat/R/test-that.R:40:2
 3. testthat::local_reproducible_output(.env = .env)
      at testthat/R/local.R:70:4
───────────────────────────────────────────────────────────

dgkf avatar Jul 30 '22 21:07 dgkf

This issue has been annoying me for a while, so when I saw that the suggested changes were pretty minimal I just went ahead and fixed it locally. It was just a little extra work to prep it to share. Happy to make whatever changes are needed to get this issue resolved.

dgkf avatar Jul 30 '22 21:07 dgkf

Thanks! I ended up removing the test because I don't think it actually tests the case we really care about, and hence just gives a false sense of security.

hadley avatar Sep 21 '22 17:09 hadley