Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testthat no longer suppresses messages #189

Closed
richfitz opened this issue Oct 4, 2014 · 1 comment
Closed

testthat no longer suppresses messages #189

richfitz opened this issue Oct 4, 2014 · 1 comment

Comments

@richfitz
Copy link

richfitz commented Oct 4, 2014

Minimal example:

Run interactively or via test_file this produces does not print a message to screen 0.7/0.8, but does on 0.9 (and current github).

library(testthat)

f <- function(x) {
  message("I used to be hidden")
  x
}

test_that("foo", {
  expect_equal(f(1), 1)
})

Run outside of a test_that block, the message is displayed on all versions (0.7-current).

expect_equal(f(1), 1)

The message printing messes up the output when running a big block of tests that produce a lot of messages as messages are interspersed through all the progress dots.

I believe this was incorporated in 2a60cc9, because prior to that, because this block suppresses messages while this block does not. I can't see where in the nested tryCatch/withCallingHandlers that a suppressMessages would go now (or the magic incantation to get invokeRestart("muffleMessage") to work).

Output of sessionInfo:

R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] testthat_0.9.1.9000

loaded via a namespace (and not attached):
 [1] devtools_1.5   digest_0.6.4   evaluate_0.5.5 httr_0.3       memoise_0.2.1 
 [6] parallel_3.1.1 RCurl_1.95-4.3 stringr_0.6.2  tools_3.1.1    whisker_0.3-2 
@hadley
Copy link
Member

hadley commented Nov 7, 2014

Yeah this is super annoying :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants