Code Monkey home page Code Monkey logo

Comments (4)

djspiewak avatar djspiewak commented on May 29, 2024 1

I'd have to look back, but I imagine the reason it's being overridden is because the reasoning in the paragraph you quoted isn't particularly compelling. :-) In general, the right way to implement this sort of concern is a rate limiting on the number of tests being run, not a rate limiting on the thread pool. The paragraph is essentially making the argument that concurrency is bad, which… I'm not sure I buy.

With that said, the global EC is also usually quite bad, but for other reasons.

With all of that said, your use-case sounds like it really does need to be sequential. I don't know ScalaTest very well; I take it that it has no equivalent to Specs2's sequential scheduling strategy?

from cats-effect-testing.

fchaillou avatar fchaillou commented on May 29, 2024

Hello,
I also had inconsistencies with my test runs with that, i also reverted to the scalatest default EC and it works "normally" with that change.

@djspiewak I agree with you that this is not really logical but i think that's the way scalatest implements async tests.
I would really love to migrate my code to another test framework but for now it will have to do :)

from cats-effect-testing.

hugo-vrijswijk avatar hugo-vrijswijk commented on May 29, 2024

From what I could tell ScalaTest's async test setup depends on a synchronous EC, which is how it guarantees tests are run in serial. If you have that you don't need to build any fancy logic for waiting for previous async test results I suppose. I'm guessing this is maybe legacy code from when ScalaTest only had sync testing? I agree it's not a particularly good reason to have a synchronous EC. IMO if your production code is concurrent, your tests should be too (race conditions and all).

ScalaTest says it runs all tests in the same suite sequentially if you don't use ParallelTestExecution but apparently that's not the case when using async tests. In my opinion ScalaTest should have the same behaviour with sync and async tests of waiting for one test to finish before starting another. But that's outside of the scope for this issue and library.

For now I've created my own copy of the AsyncIOSpec which leaves out the EC:

trait AsyncIOSpec extends AssertingSyntax with EffectTestSupport { asyncTestSuite: AsyncTestSuite =>
  implicit val ioContextShift: ContextShift[IO] = IO.contextShift(executionContext)
  implicit val ioTimer: Timer[IO] = IO.timer(executionContext)
}

from cats-effect-testing.

hugo-vrijswijk avatar hugo-vrijswijk commented on May 29, 2024

I think this library now uses the ScalaTest EC? Either way this has been explained to me, so I'll close this issue. Thank you for this wonderful library!

from cats-effect-testing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.