Skip to content

Commit 8fec7e6

Browse files
committed
Don't run heavy tests in _Run all_ action
Fixes #88
1 parent e46f0bd commit 8fec7e6

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/org/jetbrains/kotlin/test/helper/services/TestDataRunnerService.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.test.helper.buildRunnerLabel
2222
import org.jetbrains.kotlin.test.helper.gradle.GradleRunConfig
2323
import org.jetbrains.kotlin.test.helper.gradle.computeGradleCommandLine
2424
import org.jetbrains.kotlin.test.helper.gradle.runGradleCommandLine
25+
import org.jetbrains.kotlin.test.helper.isHeavyTest
2526
import org.jetbrains.kotlin.test.helper.toFileNamesString
2627
import javax.swing.ListSelectionModel
2728

@@ -45,6 +46,7 @@ class TestDataRunnerService(
4546

4647
smartReadAction(project) {
4748
val testDeclarations = filterAndCollectTestDeclarations(files, project)
49+
.filter { !it.isHeavyTest() }
4850

4951
val filtered = if (!filterByClass.isNullOrEmpty()) {
5052
groupTests(testDeclarations)[filterByClass] ?: testDeclarations
@@ -124,4 +126,4 @@ class TestDataRunnerService(
124126
.groupBy { it.parentsOfType<PsiClass>().last() }
125127
.mapKeys { it.key.buildRunnerLabel(testTags) }
126128
}
127-
}
129+
}

src/org/jetbrains/kotlin/test/helper/utils.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.jetbrains.kotlin.test.helper
22

33
import com.intellij.psi.PsiClass
4+
import com.intellij.psi.PsiNameIdentifierOwner
5+
import com.intellij.psi.util.parentsOfType
46
import java.io.IOException
57
import java.nio.file.FileVisitResult
68
import java.nio.file.Files
@@ -50,10 +52,19 @@ fun PsiClass.buildRunnerLabel(allTags: Map<String, Array<String>>): String {
5052
} else null
5153
}.orEmpty()
5254
return buildString {
55+
if (this@buildRunnerLabel.isHeavyTest()) {
56+
this.append("{H} ")
57+
}
5358
if (tags.isNotEmpty()) {
5459
this.append(tags.joinToString(prefix = "[", postfix = "] ", separator = ", "))
5560
}
5661
this.append(runnerName)
5762
}
5863
}
5964

65+
private const val HEAVY_TEST_ANNOTATION_FQN = "org.jetbrains.kotlin.test.HeavyTest"
66+
67+
fun PsiNameIdentifierOwner.isHeavyTest(): Boolean {
68+
return this.parentsOfType<PsiClass>(withSelf = true)
69+
.any { it.hasAnnotation(HEAVY_TEST_ANNOTATION_FQN) }
70+
}

0 commit comments

Comments
 (0)