diff --git a/test/ParallelDriverTest.php b/test/ParallelDriverTest.php index a770e10..5dc7723 100644 --- a/test/ParallelDriverTest.php +++ b/test/ParallelDriverTest.php @@ -2,12 +2,27 @@ namespace Amp\File\Test; +use Amp\Loop; use Amp\Parallel\Worker\DefaultPool; class ParallelDriverTest extends DriverTest { + /** @var \Amp\Parallel\Worker\Pool */ + private $pool; + + public function setUp() { + $this->pool = new DefaultPool; + $this->pool->start(); + } + + public function tearDown() { + Loop::run(function () { + yield $this->pool->shutdown(); + }); + } + protected function lRun(callable $cb) { \Amp\Loop::run(function() use ($cb) { - \Amp\File\filesystem(new \Amp\File\ParallelDriver(new DefaultPool)); + \Amp\File\filesystem(new \Amp\File\ParallelDriver($this->pool)); \Amp\Promise\rethrow(new \Amp\Coroutine($cb())); }); } diff --git a/test/ParallelHandleTest.php b/test/ParallelHandleTest.php index baae650..6d98d42 100644 --- a/test/ParallelHandleTest.php +++ b/test/ParallelHandleTest.php @@ -2,12 +2,27 @@ namespace Amp\File\Test; +use Amp\Loop; use Amp\Parallel\Worker\DefaultPool; class ParallelHandleTest extends HandleTest { + /** @var \Amp\Parallel\Worker\Pool */ + private $pool; + + public function setUp() { + $this->pool = new DefaultPool; + $this->pool->start(); + } + + public function tearDown() { + Loop::run(function () { + yield $this->pool->shutdown(); + }); + } + protected function lRun(callable $cb) { \Amp\Loop::run(function() use ($cb) { - \Amp\File\filesystem(new \Amp\File\ParallelDriver(new DefaultPool)); + \Amp\File\filesystem(new \Amp\File\ParallelDriver($this->pool)); \Amp\Promise\rethrow(new \Amp\Coroutine($cb())); }); }