mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-19738: Do not rerun tests if we can't get list of specs to rerun
When rerun, test task should provide list of test specs to rerun. If it fails to do so, no need to rerun "something".
This commit is contained in:
@@ -765,6 +765,8 @@ QDOC.module.path.unknown=(Module path is unknown)
|
||||
QDOC.epydoc.python2.sdk.not.found=You need configured Python 2 SDK to render <a href='http://epydoc.sourceforge.net/'>Epydoc</a> docstrings
|
||||
QDOC.sdk.not.found=You need configured Python SDK to render docstrings
|
||||
|
||||
runcfg.tests.cant_rerun=Can't rerun tests since test IDs can't be resolved. Try to delete run configuration, and create new one using right click.
|
||||
|
||||
### doctest run conf
|
||||
runcfg.doctest.display_name=Doctests
|
||||
runcfg.doctest.description=Python's doctests run configuration
|
||||
|
||||
@@ -25,7 +25,10 @@ import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.RunContentBuilder;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.testing.PythonTestCommandLineStateBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -41,12 +44,20 @@ public class PythonRunner extends DefaultProgramRunner {
|
||||
return executorId.equals(DefaultRunExecutor.EXECUTOR_ID) && profile instanceof AbstractPythonRunConfiguration;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
|
||||
FileDocumentManager.getInstance().saveAllDocuments();
|
||||
|
||||
ExecutionResult executionResult;
|
||||
RunProfile profile = env.getRunProfile();
|
||||
|
||||
if (state instanceof PythonTestCommandLineStateBase) {
|
||||
if (!((PythonTestCommandLineStateBase)state).isRerunEnabled()) {
|
||||
throw new ExecutionException(PyBundle.message("runcfg.tests.cant_rerun"));
|
||||
}
|
||||
}
|
||||
|
||||
if (state instanceof PythonCommandLineState && profile instanceof CommandLinePatcher) {
|
||||
executionResult = ((PythonCommandLineState)state).execute(env.getExecutor(), (CommandLinePatcher)profile);
|
||||
}
|
||||
|
||||
@@ -171,4 +171,11 @@ public abstract class PythonTestCommandLineStateBase extends PythonCommandLineSt
|
||||
protected abstract HelperPackage getRunner();
|
||||
@NotNull
|
||||
protected abstract List<String> getTestSpecs();
|
||||
|
||||
/**
|
||||
* @return is it possible to rerun tests now?
|
||||
*/
|
||||
public boolean isRerunEnabled() {
|
||||
return !getTestSpecs().isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user