mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[junit 5] slow tests to be skipped locally
GitOrigin-RevId: e1cf400cd62ab64cad703e98550ab11aed5726a6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9789b5b05d
commit
f6e9a3d020
@@ -0,0 +1,20 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.idea.extensions;
|
||||
|
||||
import com.intellij.testFramework.SkipSlowTestLocally;
|
||||
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
|
||||
import org.junit.jupiter.api.extension.ExecutionCondition;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.platform.commons.support.AnnotationSupport;
|
||||
|
||||
public class SkipSlowExecutionCondition implements ExecutionCondition {
|
||||
private static final ConditionEvaluationResult ENABLED = ConditionEvaluationResult.enabled("Enabled locally");
|
||||
private static final ConditionEvaluationResult DISABLED = ConditionEvaluationResult.disabled("Slow tests are disabled locally");
|
||||
private static final boolean SKIP_SLOW_TESTS = System.getProperty("skip.slow.tests.locally") != null;
|
||||
|
||||
@Override
|
||||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
|
||||
if (!SKIP_SLOW_TESTS) return ENABLED;
|
||||
return AnnotationSupport.findAnnotation(context.getTestClass(), SkipSlowTestLocally.class).isPresent() ? DISABLED : ENABLED;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.idea.extensions.SkipSlowExecutionCondition;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -26,4 +15,5 @@ import java.lang.annotation.Target;
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ExtendWith(SkipSlowExecutionCondition.class)
|
||||
public @interface SkipSlowTestLocally { }
|
||||
|
||||
Reference in New Issue
Block a user