Skip to content

Commit

Permalink
fix: emulator tests (apply @flaky)
Browse files Browse the repository at this point in the history
`IgnoreFlakyTestsInCIRule` was not applied to the test class

So we apply the rule, and improve the documentation
  • Loading branch information
david-allison committed Feb 2, 2024
1 parent b424741 commit 8d3b4d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import com.ichi2.libanki.Collection
import com.ichi2.libanki.Consts
import com.ichi2.libanki.Note
import com.ichi2.libanki.utils.TimeManager
import com.ichi2.testutils.IgnoreFlakyTestsInCIRule
import kotlinx.coroutines.runBlocking
import net.ankiweb.rsdroid.BackendException
import org.junit.After
Expand All @@ -55,6 +56,10 @@ abstract class InstrumentedTest {
@get:Rule
val ensureAllFilesAccessRule = EnsureAllFilesAccessRule()

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

/**
* @return A File object pointing to a directory in which temporary test files can be placed. The directory is
* emptied on every invocation of this method so it is suitable to use at the start of each test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ import java.util.*

/**
* An annotation which marks a test as flaky so it will be skipped if run under CI
*
* The test class or a subclass must contain the code:
*
* ```kotlin
* @get:Rule
* val ignoreFlakyTests = IgnoreFlakyTestsInCIRule()
* ```
*
* @see IgnoreFlakyTestsInCIRule
*
* @param os The OS The test fails under (required)
* @param message The message to display when the test is skipped
*/
Expand Down

0 comments on commit 8d3b4d2

Please sign in to comment.