test/test_backend.rb in polyphony-0.94 vs test/test_backend.rb in polyphony-0.95

- old
+ new

@@ -142,11 +142,15 @@ buf << :ready @backend.read_loop(i, 8192) { |d| buf << d } buf << :done end - # writing always causes snoozing + # Caution: we want to read in two chunks, that a race condition lurks here: + # writing always causes snoozing, but that might not be enough for the + # reader fiber to perform the read before the second write, so for the test + # to work consistently we add a little sleep between the two writes. o << 'foo' + sleep 0.03 o << 'bar' o.close f.await assert_equal [:ready, 'foo', 'bar', :done], buf