Skip to content

Commit cd07f44

Browse files
committed
Improve this test
Closes #611
1 parent 2cf86c2 commit cd07f44

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/testthat/test-connection.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,16 @@ test_that("vroom_fwf() doesn't leak a connection when opening fails (permission
116116
Sys.chmod(tfile, mode = "000") # Remove all permissions
117117
connections_before <- showConnections(all = TRUE)
118118

119-
# Not using snapshots, because not our error or warning
120-
expect_error(
121-
expect_warning(
119+
# It is conceivable that this vroom_fwf() will succeed if, for example, tests
120+
# are being run by root?
121+
# See https://github.com/tidyverse/vroom/issues/611
122+
# Therefore, we don't state a hard expectation around error or warning.
123+
# We just care that connections don't leak.
124+
try(
125+
suppressWarnings(
122126
vroom_fwf(file(tfile), fwf_widths(c(6, 6, 6)), show_col_types = FALSE)
123127
),
124-
"cannot open"
128+
silent = TRUE
125129
)
126130

127131
connections_after <- showConnections(all = TRUE)

0 commit comments

Comments
 (0)