Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cats-effect, cats-effect-laws to 3.5.7 in series/0.x #610

Open
wants to merge 2 commits into
base: series/0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ThisBuild / scmInfo := Some(
url("https://github.com/djspiewak/cats-effect-testing"),
"[email protected]:djspiewak/cats-effect-testing.git"))

val CatsEffectVersion = "2.5.5"
val CatsEffectVersion = "3.5.7"

lazy val root = project
.in(file("."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]] {

Expand Down
5 changes: 3 additions & 2 deletions specs2/src/main/scala/cats/effect/testing/specs2/CatsIO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ 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 {
protected val testContext: TestContext = TestContext()
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Loading