I was using Kotlin Coroutines version `1.6.4` in m...
# coroutines
m
I was using Kotlin Coroutines version
1.6.4
in my project, after adding a library with dependency to Kotlin Coroutines
1.7.0-Beta
, tests using
runTest
started failing because of
backgroundScope
premature cancellation, the problem was gone after updating this project Kotlin Coroutines version to
1.7.0-Beta
. Can anyone explain it to me?
d
runTest
was reworked quite a bit for
1.7.0-Beta
, but there was no intention to change the behavior of
backgroundScope
. Maybe we introduced a bug (or accidentally fixed one). Could you file an issue at https://github.com/Kotlin/kotlinx.coroutines/issues with an example of the code that behaves incorrectly?
Ah, sorry, I misread: your problem is not with the test module itself but with the incompatibility between
1.7.0-Beta
and
1.6.4
. If I understood correctly this time, the issue is with using
kotlinx-coroutines-core:1.7.0-Beta
with
kotlinx-coroutines-test:1.6.4
, right?
m
That is the strange part: Project use coroutines regular and test 1.6.4 Lib use coroutines 1.7.0-Beta Just adding lib (without using anything from inside) changed runTest behavior
Lib uses Gradle kts with coroutines in
implementation
block
I might try to make.a simple project that illustrates it, but likely not today
d
Typically, gradle won't depend on several copies of the same library. Instead, it analyzes all the usages of a library and selects a single version that should suit everyone. In your case,
kotlinx-coroutines-core
would use the upgraded version for the whole project.