choose correct test file
authorLiana.Bakradze <liana.bakradze@jetbrains.com>
Thu, 27 Oct 2016 14:50:05 +0000 (17:50 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 17 Nov 2016 14:08:36 +0000 (17:08 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckUtils.java
python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyTestRunner.java

index 2f5ac54c64a018881d572a6c3f42c0a244a525ab..92cc5aff9283e77ff68c00c9806a39dd9fe97b3d 100644 (file)
@@ -139,7 +139,7 @@ public class StudyCheckUtils {
   private static VirtualFile getCopyWithAnswers(@NotNull final VirtualFile taskDir,
                                                 @NotNull final VirtualFile file,
                                                 @NotNull final TaskFile source,
-                                                @NotNull final TaskFile target) {
+                                                @NotNull TaskFile target) {
     VirtualFile copy = null;
     try {
 
@@ -147,7 +147,10 @@ public class StudyCheckUtils {
       final FileDocumentManager documentManager = FileDocumentManager.getInstance();
       final Document document = documentManager.getDocument(copy);
       if (document != null) {
-        TaskFile.copy(source, target);
+        target = source.getTask().copy().getTaskFile(file.getName());
+        if (target == null) {
+          return copy;
+        }
         EduDocumentListener listener = new EduDocumentListener(target);
         document.addDocumentListener(listener);
         for (AnswerPlaceholder answerPlaceholder : target.getActivePlaceholders()) {
index 6ae2fa3d338b4c9d4f884e255bb0f60bac42ba05..e3cf99aecb0fddcd7f63d7c4ce66ea3b4aafba01 100644 (file)
@@ -37,9 +37,9 @@ public class PyStudyTestRunner extends StudyTestRunner {
     }
 
     String testsFileName = manager.getTestFileName();
-    if (myTask.hasSubtasks()) {
+    if (myTask.hasSubtasks() && myTask.getActiveSubtaskIndex() != 0) {
       testsFileName = FileUtil.getNameWithoutExtension(testsFileName);
-      int index = myTask.getActiveSubtaskIndex() + 1;
+      int index = myTask.getActiveSubtaskIndex();
       testsFileName += EduNames.SUBTASK_MARKER + index + "." + FileUtilRt.getExtension(manager.getTestFileName());
     }
     final File testRunner = new File(myTaskDir.getPath(), testsFileName);