mkrussel
11/02/2023, 2:48 PMDispatchers.setMain
, but that is the function creating the stack trace.Chrimaeon
11/02/2023, 3:21 PMTestDispatchers
not Dispatchers
Chrimaeon
11/02/2023, 3:23 PMmkrussel
11/02/2023, 3:25 PMsetMain
and I'm trying to use it. What seems to be happening is setMain
grabs a copy of the current Main to support resetMain
, but getting the current version fails and that failure gets logged.
Is there something that I can do to prevent this behavior.Chrimaeon
11/02/2023, 3:26 PMmkrussel
11/02/2023, 3:28 PM@Before
override fun setUp() {
Dispatchers.setMain(Dispatchers.Unconfined)
viewportManager.setUp()
}
@After
override fun tearDown() {
if (this::viewport.isInitialized) {
viewport.dispose()
}
viewportManager.tearDown()
Dispatchers.resetMain()
}
The stack trace points to my call of `Dispatchers.setMain(Dispatchers.Unconfined)`
Chrimaeon
11/02/2023, 3:29 PMTestDispatcher
. here’s how I use it in my projects https://github.com/chrimaeon/curriculumvitae/blob/b3fa2fdc9d47a8f34d3fd9845c948cd8[…]cmgapps/android/curriculumvitae/test/MainDispatcherExtension.ktChrimaeon
11/02/2023, 3:31 PMUsing TestDispatcher as an argument has special behavior: subsequently-called runTest, as well as TestScope and test dispatcher constructors, will use the TestCoroutineScheduler of the provided dispatcher.
mkrussel
11/02/2023, 3:37 PMsetMain
function doesn't look at the dispatcher type. Trying to run again, but it is no longer printing this stack trace even though I didn't change anything.