Skip to content

Testthat reporting warnings that do not appear in code #958

@jeroen

Description

@jeroen

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:

Screen Shot 2019-11-04 at 8 44 45 PM

This warning should never appear because R sets options(warn = -1L) internally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions