Comments (4)
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.
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.
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.
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)
- support for cats-effect 3.x HOT 2
- Scalatest deadlocks very easily HOT 5
- `libraryDependencies` link is broken HOT 3
- utest assert macro package clash HOT 3
- was cats-effect-testing-scalatest-scalacheck deprecated? HOT 3
- Scalacheck module? HOT 2
- Core module publishes as `"org.typelevel" %% "core"` HOT 5
- Plan for specs2 v5.0.0? HOT 1
- Experiment with time mocking APIs
- How about a new release? HOT 4
- `NoSuchMethodError` on specs2 test using `CatsEffect` trait HOT 2
- Specs2 timeouts should fail
- Setup credentials for CI release
- CatsResourceIO in scalatest doesn't release the resource HOT 8
- Allow user to select which style to use in ScalaTest
- Global IORuntime threadpools are not closed in tests, causing a resource leak
- Implement ScalaTest ioRetrying with a generic effect type
- Enable multiple `asserting` clauses? HOT 1
- MUnit support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cats-effect-testing.