fix check utilities
[idea/community.git] / python / educational-python / student-python / src / com / jetbrains / edu / learning / PyStudyTestRunner.java
index f7c64d1099f149e6b843b279321c2c1f869c961a..6ae2fa3d338b4c9d4f884e255bb0f60bac42ba05 100644 (file)
@@ -7,8 +7,10 @@ import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.io.FileUtilRt;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.jetbrains.edu.learning.checker.StudyTestRunner;
+import com.jetbrains.edu.learning.core.EduNames;
 import com.jetbrains.edu.learning.courseFormat.Course;
 import com.jetbrains.edu.learning.courseFormat.Task;
 import com.jetbrains.python.sdk.PythonSdkType;
@@ -35,6 +37,11 @@ public class PyStudyTestRunner extends StudyTestRunner {
     }
 
     String testsFileName = manager.getTestFileName();
+    if (myTask.hasSubtasks()) {
+      testsFileName = FileUtil.getNameWithoutExtension(testsFileName);
+      int index = myTask.getActiveSubtaskIndex() + 1;
+      testsFileName += EduNames.SUBTASK_MARKER + index + "." + FileUtilRt.getExtension(manager.getTestFileName());
+    }
     final File testRunner = new File(myTaskDir.getPath(), testsFileName);
     final GeneralCommandLine commandLine = new GeneralCommandLine();
     commandLine.withWorkDirectory(myTaskDir.getPath());