From 118a296dac8f7e828c0b8205e2b29e09cc723672 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Sat, 13 Apr 2024 19:34:27 +0200 Subject: [PATCH] Fix ResourceOutputStreamTest on macOS --- test/ResourceOutputStreamTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ResourceOutputStreamTest.php b/test/ResourceOutputStreamTest.php index 2394dae..5374c40 100644 --- a/test/ResourceOutputStreamTest.php +++ b/test/ResourceOutputStreamTest.php @@ -5,6 +5,7 @@ use Amp\ByteStream\ResourceOutputStream; use Amp\ByteStream\StreamException; use Amp\PHPUnit\AsyncTestCase; +use function Amp\delay; use const PHP_OS; class ResourceOutputStreamTest extends AsyncTestCase @@ -72,8 +73,9 @@ public function testClosedRemoteSocket(): ?\Generator $this->expectException(StreamException::class); $this->expectExceptionMessage(/* S|s */ "end of 6 bytes failed with errno=" . (\stripos(PHP_OS, "win") === 0 ? "10053" : "32 Broken pipe")); - // The first write still succeeds somehow... yield $stream->write("foobar"); + // There's some delay until a write fails on macOS (and possibly other OSes) + yield delay(100); yield $stream->write("foobar"); } }