From 6d5b53535c9d1b6c5cf3a587a09fba8c9db8510b Mon Sep 17 00:00:00 2001 From: "Liana.Bakradze" Date: Fri, 7 Apr 2017 13:55:29 +0300 Subject: [PATCH] EDU-904 Do not run file before check in Edu Python --- .../edu/learning/checker/StudyCheckTask.java | 16 ---------------- .../fileTemplates/internal/test_helper.py.ft | 7 ------- 2 files changed, 23 deletions(-) diff --git a/python/educational-core/src/com/jetbrains/edu/learning/checker/StudyCheckTask.java b/python/educational-core/src/com/jetbrains/edu/learning/checker/StudyCheckTask.java index 2db45eeb83e3..55e82678ab00 100644 --- a/python/educational-core/src/com/jetbrains/edu/learning/checker/StudyCheckTask.java +++ b/python/educational-core/src/com/jetbrains/edu/learning/checker/StudyCheckTask.java @@ -3,7 +3,6 @@ package com.jetbrains.edu.learning.checker; import com.intellij.execution.process.CapturingProcessHandler; import com.intellij.execution.process.ProcessOutput; import com.intellij.ide.projectView.ProjectView; -import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; @@ -16,7 +15,6 @@ import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.jetbrains.edu.learning.*; -import com.jetbrains.edu.learning.actions.StudyRunAction; import com.jetbrains.edu.learning.core.EduNames; import com.jetbrains.edu.learning.core.EduUtils; import com.jetbrains.edu.learning.courseFormat.AnswerPlaceholder; @@ -47,9 +45,7 @@ public class StudyCheckTask extends com.intellij.openapi.progress.Task.Backgroun private final Ref myCheckInProcess; private final Process myTestProcess; private final String myCommandLine; - private boolean myRunTestFile = true; private static final String FAILED_CHECK_LAUNCH = "Failed to launch checking"; - private static final String DO_NOT_RUN_ON_CHECK = "DO_NOT_RUN_ON_CHECK"; public StudyCheckTask(Project project, StudyState studyState, Ref checkInProcess, Process testProcess, String commandLine) { super(project, "Checking Task"); @@ -98,9 +94,6 @@ public class StudyCheckTask extends com.intellij.openapi.progress.Task.Backgroun private void checkForEduCourse(@NotNull ProgressIndicator indicator) { final StudyTestsOutputParser.TestsOutput testsOutput = getTestOutput(indicator); - if (myRunTestFile) { - ApplicationManager.getApplication().invokeLater(() -> runTask(myProject)); - } if (testsOutput != null) { if (testsOutput.isSuccess()) { onTaskSolved(testsOutput.getMessage()); @@ -119,14 +112,6 @@ public class StudyCheckTask extends com.intellij.openapi.progress.Task.Backgroun } } - private static void runTask(@NotNull Project project) { - final StudyRunAction runAction = (StudyRunAction)ActionManager.getInstance().getAction(StudyRunAction.ACTION_ID); - if (runAction == null) { - return; - } - runAction.run(project); - } - @Nullable private StudyTestsOutputParser.TestsOutput getTestOutput(@NotNull ProgressIndicator indicator) { final CapturingProcessHandler handler = new CapturingProcessHandler(myTestProcess, null, myCommandLine); @@ -135,7 +120,6 @@ public class StudyCheckTask extends com.intellij.openapi.progress.Task.Backgroun ApplicationManager.getApplication().invokeLater( () -> StudyCheckUtils.showTestResultPopUp("Check cancelled", MessageType.WARNING.getPopupBackground(), myProject)); } - myRunTestFile = !output.getStdout().contains(DO_NOT_RUN_ON_CHECK); final Course course = StudyTaskManager.getInstance(myProject).getCourse(); if (course != null) { final StudyTestsOutputParser.TestsOutput testsOutput = StudyTestsOutputParser.getTestsOutput(output, course.isAdaptive()); diff --git a/python/educational-python/resources/fileTemplates/internal/test_helper.py.ft b/python/educational-python/resources/fileTemplates/internal/test_helper.py.ft index 42bdaa245c70..16ba2d37f90c 100644 --- a/python/educational-python/resources/fileTemplates/internal/test_helper.py.ft +++ b/python/educational-python/resources/fileTemplates/internal/test_helper.py.ft @@ -218,13 +218,6 @@ def check_samples(samples=()): passed() -def do_not_run_on_check(): - """ - Do not execute task file on check - """ - print("#educational_plugin DO_NOT_RUN_ON_CHECK") - - def run_common_tests(error_text="Please, reload file and try again"): test_is_not_empty() test_answer_placeholders_text_deleted()