Minimal reprex
from @gaborcsardi
test_that("x", {
op <- options(warn = -1)
warning("not see this")
options(op)
expect_true(TRUE)
})
Real world case
If you run this in R, there is no warning:
out <- available.packages(repos = 'https://cloud.r-project.org', type = 'mac.binary.el-capitan')
However if you run this code anywhere in testthat:

This warning should never appear because R sets options(warn = -1L) internally.
Minimal reprex
from @gaborcsardi
Real world case
If you run this in R, there is no warning:
However if you run this code anywhere in testthat:
This warning should never appear because R sets
options(warn = -1L)internally.