Skip to content

Commit

Permalink
Rm custom deterministic runtime creation method
Browse files Browse the repository at this point in the history
  • Loading branch information
danicheg committed Sep 29, 2021
1 parent 913a4de commit 0d6f6cb
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions core/shared/src/test/scala/fs2/Fs2Suite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@

package fs2

import scala.concurrent.duration._
import scala.concurrent.ExecutionContext

import cats.effect.unsafe.{IORuntime, IORuntimeConfig, Scheduler}
import cats.effect.kernel.testkit.TestContext

import munit.{CatsEffectSuite, DisciplineSuite, ScalaCheckEffectSuite}

import scala.concurrent.ExecutionContext

abstract class Fs2Suite
extends CatsEffectSuite
with DisciplineSuite
Expand All @@ -45,25 +41,6 @@ abstract class Fs2Suite

override val munitExecutionContext: ExecutionContext = ExecutionContext.global

/* Creates a new environment for deterministic tests which require stepping through */
protected def createDeterministicRuntime: (TestContext, IORuntime) = {
val ctx = TestContext()

val scheduler = new Scheduler {
def sleep(delay: FiniteDuration, action: Runnable): Runnable = {
val cancel = ctx.schedule(delay, action)
new Runnable { def run() = cancel() }
}

def nowMillis() = ctx.now().toMillis
def monotonicNanos() = ctx.now().toNanos
}

val runtime = IORuntime(ctx, ctx, scheduler, () => (), IORuntimeConfig())

(ctx, runtime)
}

/** Returns a stream that has a 10% chance of failing with an error on each output value. */
protected def spuriousFail[F[_]: RaiseThrowable, O](s: Stream[F, O]): Stream[F, O] =
Stream.suspend {
Expand Down

0 comments on commit 0d6f6cb

Please sign in to comment.