Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/CoroutineHelpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ interface OnErrorListener {
fun <T, U> T.launchCatchingIO(block: suspend T.() -> U): Job where T : ViewModel, T : OnErrorListener =
viewModelScope.launchCatching(
ioDispatcher,
{ onError.emit(it) },
{
onError.emit(it)
if (throwOnShowError) throw IllegalStateException("throwOnShowError: $it")
},
{ block() },
)

Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/test/java/com/ichi2/anki/RobolectricTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ open class RobolectricTest :
controllersForCleanup.add(controller)
}

/** Allows [com.ichi2.testutils.Flaky] to annotate tests in subclasses */
/** Allows [com.ichi2.testutils.common.Flaky] to annotate tests in subclasses */
@get:Rule
val ignoreFlakyTests = IgnoreFlakyTestsInCIRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class PreviewerViewModelTest : JvmTest() {
}

@Test
@Flaky(OS.ALL, "#19729")
fun `toggle back side only`() =
runTest {
assertFalse(viewModel.backSideOnly.value) // initial state should be false
Expand Down Expand Up @@ -176,7 +177,7 @@ class PreviewerViewModelTest : JvmTest() {
}

@Test
@Flaky(OS.ALL) // 19729: failed on macOS
@Flaky(OS.ALL, "#19729")
fun `next, slider and previous navigation integration`() =
runTest {
// 1. Start at Index 0 (Question)
Expand Down
6 changes: 6 additions & 0 deletions AnkiDroid/src/test/java/com/ichi2/testutils/JvmTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ import androidx.annotation.CallSuper
import com.ichi2.anki.ioDispatcher
import com.ichi2.anki.libanki.testutils.InMemoryAnkiTest
import com.ichi2.anki.observability.ChangeManager
import com.ichi2.testutils.common.IgnoreFlakyTestsInCIRule
import kotlinx.coroutines.test.TestDispatcher
import org.junit.Before
import org.junit.Rule

open class JvmTest : InMemoryAnkiTest() {
/** Allows [com.ichi2.testutils.common.Flaky] to annotate tests in subclasses */
@get:Rule
val ignoreFlakyTests = IgnoreFlakyTestsInCIRule()

@Before
@CallSuper
override fun setUp() {
Expand Down