Skip to content

ScalaTest CatsResource hangs on Resource acquisition failure #634

@bpholt

Description

@bpholt

This appears to be similar to the issue I fixed in #608 for Specs2. Consider a test like this:

class CatsResourceErrorSpecs extends FixtureAsyncWordSpec with CatsResourceIO[Int]  {
  override val resource: Resource[IO, Int] =
    IO.raiseError(new RuntimeException("boom")).toResource

  "cats resource specifications" should {
    "report errors in resource acquisition" in { i =>
      fail(s"should not get here, but received $i")
    }
  }
}

Currently, ScalaTest / cats-effect-testing will not report the RuntimeException; it will manifest as a timeout if ResourceTimeout is finite.

I'm working on a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions