diff --git a/build.sbt b/build.sbt index a675533..a3bc22d 100644 --- a/build.sbt +++ b/build.sbt @@ -34,7 +34,7 @@ ThisBuild / scmInfo := Some( url("https://github.com/djspiewak/cats-effect-testing"), "git@github.com:djspiewak/cats-effect-testing.git")) -val CatsEffectVersion = "2.5.5" +val CatsEffectVersion = "3.5.7" lazy val root = project .in(file(".")) diff --git a/minitest/src/main/scala/cats/effect/testing/minitest/BaseIOTestSuite.scala b/minitest/src/main/scala/cats/effect/testing/minitest/BaseIOTestSuite.scala index 4f5b48d..894c125 100644 --- a/minitest/src/main/scala/cats/effect/testing/minitest/BaseIOTestSuite.scala +++ b/minitest/src/main/scala/cats/effect/testing/minitest/BaseIOTestSuite.scala @@ -18,8 +18,9 @@ package cats.effect.testing.minitest import scala.concurrent.ExecutionContext -import cats.effect.{ContextShift, IO, Timer} +import cats.effect.IO import minitest.api._ +import cats.effect.Temporal private[effect] abstract class BaseIOTestSuite[Ec <: ExecutionContext] extends AbstractTestSuite with Asserts { @@ -29,7 +30,7 @@ private[effect] abstract class BaseIOTestSuite[Ec <: ExecutionContext] extends A protected[effect] implicit def suiteEc: ExecutionContext = executionContext implicit def ioContextShift: ContextShift[IO] = IO.contextShift(executionContext) - implicit def ioTimer: Timer[IO] = IO.timer(executionContext) + implicit def ioTimer: Temporal[IO] = IO.timer(executionContext) protected[effect] def mkSpec(name: String, ec: Ec, io: => IO[Unit]): TestSpec[Unit, Unit] diff --git a/minitest/src/main/scala/cats/effect/testing/minitest/DeterministicIOTestSuite.scala b/minitest/src/main/scala/cats/effect/testing/minitest/DeterministicIOTestSuite.scala index 81ad854..09814de 100644 --- a/minitest/src/main/scala/cats/effect/testing/minitest/DeterministicIOTestSuite.scala +++ b/minitest/src/main/scala/cats/effect/testing/minitest/DeterministicIOTestSuite.scala @@ -18,11 +18,12 @@ package cats.effect.testing.minitest import scala.concurrent.ExecutionContext -import cats.effect.{ContextShift, IO, Timer} +import cats.effect.IO import cats.effect.laws.util.TestContext import scala.concurrent.duration._ import minitest.api.{DefaultExecutionContext, TestSpec} +import cats.effect.Temporal abstract class DeterministicIOTestSuite extends BaseIOTestSuite[TestContext] { override protected final def makeExecutionContext(): TestContext = TestContext() @@ -32,7 +33,7 @@ abstract class DeterministicIOTestSuite extends BaseIOTestSuite[TestContext] { override final implicit def ioContextShift: ContextShift[IO] = executionContext.contextShift[IO](IO.ioEffect) - override final implicit def ioTimer: Timer[IO] = executionContext.timer[IO](IO.ioEffect) + override final implicit def ioTimer: Temporal[IO] = executionContext.timer[IO](IO.ioEffect) override protected[effect] def mkSpec(name: String, ec: TestContext, io: => IO[Unit]): TestSpec[Unit, Unit] = diff --git a/scalatest/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala b/scalatest/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala index f1eb819..2e70544 100644 --- a/scalatest/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala +++ b/scalatest/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala @@ -16,18 +16,19 @@ package cats.effect.testing.scalatest -import cats.effect.{ContextShift, IO, Timer} +import cats.effect.IO import org.scalactic.source.Position import org.scalatest.AsyncTestSuite import org.scalatest.enablers.Retrying import org.scalatest.time.Span import scala.concurrent.ExecutionContext +import cats.effect.Temporal trait AsyncIOSpec extends AssertingSyntax with EffectTestSupport { asyncTestSuite: AsyncTestSuite => override val executionContext: ExecutionContext = ExecutionContext.global implicit val ioContextShift: ContextShift[IO] = IO.contextShift(executionContext) - implicit val ioTimer: Timer[IO] = IO.timer(executionContext) + implicit val ioTimer: Temporal[IO] = IO.timer(executionContext) implicit def ioRetrying[T]: Retrying[IO[T]] = new Retrying[IO[T]] { override def retry(timeout: Span, interval: Span, pos: Position)(fun: => IO[T]): IO[T] = diff --git a/scalatest/src/test/scala/cats/effect/testing/scalatest/CatsResourceSpecs.scala b/scalatest/src/test/scala/cats/effect/testing/scalatest/CatsResourceSpecs.scala index 7a0867f..35baf3b 100644 --- a/scalatest/src/test/scala/cats/effect/testing/scalatest/CatsResourceSpecs.scala +++ b/scalatest/src/test/scala/cats/effect/testing/scalatest/CatsResourceSpecs.scala @@ -17,9 +17,9 @@ package cats.effect.testing.scalatest import cats.effect._ -import cats.effect.concurrent.Ref import org.scalatest.matchers.must.Matchers._ import org.scalatest.wordspec.FixtureAsyncWordSpec +import cats.effect.Ref class CatsResourceSpecs extends FixtureAsyncWordSpec with AsyncIOSpec with CatsResourceIO[Ref[IO, Int]] { diff --git a/specs2/src/main/scala/cats/effect/testing/specs2/CatsIO.scala b/specs2/src/main/scala/cats/effect/testing/specs2/CatsIO.scala index 7a4aa0d..aaa98e9 100644 --- a/specs2/src/main/scala/cats/effect/testing/specs2/CatsIO.scala +++ b/specs2/src/main/scala/cats/effect/testing/specs2/CatsIO.scala @@ -16,12 +16,13 @@ package cats.effect.testing.specs2 -import cats.effect.{ContextShift, IO, Timer} +import cats.effect.IO import scala.concurrent.ExecutionContext +import cats.effect.Temporal trait CatsIO extends CatsEffect { implicit def executionContext: ExecutionContext = ExecutionContext.global implicit def ioContextShift: ContextShift[IO] = IO.contextShift(executionContext) - implicit def ioTimer: Timer[IO] = IO.timer(executionContext) + implicit def ioTimer: Temporal[IO] = IO.timer(executionContext) } diff --git a/specs2/src/test/scala/cats/effect/testing/specs2/CatsEffectSpecs.scala b/specs2/src/test/scala/cats/effect/testing/specs2/CatsEffectSpecs.scala index a1b800e..68520ac 100644 --- a/specs2/src/test/scala/cats/effect/testing/specs2/CatsEffectSpecs.scala +++ b/specs2/src/test/scala/cats/effect/testing/specs2/CatsEffectSpecs.scala @@ -17,9 +17,9 @@ package cats.effect.testing.specs2 import cats.effect.{IO, Resource} -import cats.effect.concurrent.{Ref, Deferred} import cats.implicits._ import org.specs2.mutable.Specification +import cats.effect.{ Deferred, Ref } class CatsEffectSpecs extends Specification with CatsEffect { diff --git a/specs2/src/test/scala/cats/effect/testing/specs2/CatsResourceSpecs.scala b/specs2/src/test/scala/cats/effect/testing/specs2/CatsResourceSpecs.scala index 4bd9764..67db529 100644 --- a/specs2/src/test/scala/cats/effect/testing/specs2/CatsResourceSpecs.scala +++ b/specs2/src/test/scala/cats/effect/testing/specs2/CatsResourceSpecs.scala @@ -17,8 +17,8 @@ package cats.effect.testing.specs2 import cats.effect._ -import cats.effect.concurrent.Ref import org.specs2.mutable.Specification +import cats.effect.Ref class CatsResourceSpecs extends Specification with CatsResourceIO[Ref[IO, Int]] { sequential diff --git a/utest/src/main/scala/cats/effect/testing/utest/DeterministicIOTestSuite.scala b/utest/src/main/scala/cats/effect/testing/utest/DeterministicIOTestSuite.scala index 9b9f7aa..8c37aa4 100644 --- a/utest/src/main/scala/cats/effect/testing/utest/DeterministicIOTestSuite.scala +++ b/utest/src/main/scala/cats/effect/testing/utest/DeterministicIOTestSuite.scala @@ -19,9 +19,10 @@ package cats.effect.testing.utest import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.duration._ -import cats.effect.{ContextShift, IO, Timer} +import cats.effect.IO import cats.effect.laws.util.TestContext import utest.TestSuite +import cats.effect.Temporal abstract class DeterministicIOTestSuite extends TestSuite { @@ -29,7 +30,7 @@ abstract class DeterministicIOTestSuite extends TestSuite { protected def allowNonIOTests: Boolean = false implicit def ioContextShift: ContextShift[IO] = testContext.contextShift(IO.ioEffect) - implicit def ioTimer: Timer[IO] = testContext.timer(IO.ioEffect) + implicit def ioTimer: Temporal[IO] = testContext.timer(IO.ioEffect) override def utestWrap(path: Seq[String], runBody: => Future[Any])(implicit ec: ExecutionContext): Future[Any] = { runBody.flatMap { diff --git a/utest/src/main/scala/cats/effect/testing/utest/IOTestSuite.scala b/utest/src/main/scala/cats/effect/testing/utest/IOTestSuite.scala index eafb859..0c0259a 100644 --- a/utest/src/main/scala/cats/effect/testing/utest/IOTestSuite.scala +++ b/utest/src/main/scala/cats/effect/testing/utest/IOTestSuite.scala @@ -19,8 +19,9 @@ package cats.effect.testing.utest import scala.concurrent.duration._ import scala.concurrent.{ExecutionContext, Future} -import cats.effect.{ContextShift, IO, Timer} +import cats.effect.IO import utest._ +import cats.effect.Temporal abstract class IOTestSuite extends TestSuite { @@ -31,7 +32,7 @@ abstract class IOTestSuite extends TestSuite { protected lazy val executionContext: ExecutionContext = makeExecutionContext() implicit def ioContextShift: ContextShift[IO] = IO.contextShift(executionContext) - implicit def ioTimer: Timer[IO] = IO.timer(executionContext) + implicit def ioTimer: Temporal[IO] = IO.timer(executionContext) override def utestWrap(path: Seq[String], runBody: => Future[Any])(implicit ec: ExecutionContext): Future[Any] = { // Shadow the parameter EC with our EC