Skip to content

Commit 602fc60

Browse files
committed
Fix printing parallel stdout w/ chunky event loop
1 parent 0085e36 commit 602fc60

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

R/parallel.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ parallel_event_loop_smooth <- function(queue, reporters, test_dir) {
144144
updated <- FALSE
145145
for (x in msgs) {
146146
if (x$code == PROCESS_OUTPUT) {
147-
lns <- paste0(x$path, ": ", x$message)
147+
lns <- paste0("> ", x$path, ": ", x$message)
148148
cat("\n", file = stdout())
149149
base::writeLines(lns, stdout())
150150
next
@@ -184,6 +184,11 @@ parallel_event_loop_chunky <- function(queue, reporters, test_dir) {
184184
while (!queue$is_idle()) {
185185
msgs <- queue$poll(Inf)
186186
for (x in msgs) {
187+
if (x$code == PROCESS_OUTPUT) {
188+
lns <- paste0("> ", x$path, ": ", x$message)
189+
base::writeLines(lns, stdout())
190+
next
191+
}
187192
if (x$code != PROCESS_MSG) {
188193
next
189194
}
@@ -210,10 +215,7 @@ parallel_event_loop_chunky <- function(queue, reporters, test_dir) {
210215
replay_events <- function(reporter, events) {
211216
snapshotter <- getOption("testthat.snapshotter")
212217
for (m in events) {
213-
if (m$code == PROCESS_OUTPUT) {
214-
lns <- paste0(m$path, ": ", m$message)
215-
base::writeLines(lns, stdout())
216-
} else if (m$type == "snapshotter") {
218+
if (m$type == "snapshotter") {
217219
do.call(snapshotter[[m$cmd]], m$args)
218220
} else {
219221
do.call(reporter[[m$cmd]], m$args)

tests/testthat/test-describe.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ describe("describe", {
5050
it("should not be possible to access variables from other specs (2)", {
5151
expect_false(exists("some_test_var"))
5252
})
53+
withr::local_options(width = 60)
5354
print(1:100)
5455
})

0 commit comments

Comments
 (0)