Michal Klimczak
03/16/2022, 10:59 AManImportantBlockingCall resembles okhttp.Authenticator.uthenticate - it's a blocking call, which in my case will run a runBlocking coroutine which will synchronise a few things and wait for them. So it really is important that in this test case this remains blocking. 🧵Michal Klimczak
03/16/2022, 10:59 AManImportantBlockingCall into thread instead of launch and do some Thread.sleeps instead of advancing virtual coroutine time. but this is what I'm trying to avoid.
concurrentTestScope was me trying to hack it, but it doesn't seem to do it concurrently to the testScope this way 😉
Any hints?
@Test
fun test() {
val testScope = TestCoroutineScope()
val concurrentTestScope = TestCoroutineScope()
fun anImportantBlockingCall() {
runBlocking(concurrentTestScope.coroutineContext) {
delay(100)
println("C")
}
}
testScope.runBlockingTest {
println("A")
launch {
anImportantBlockingCall()
}
println("B")
}
}