EDU-608 Execute "tests.py" action doesn't create Run Study Tests configuration
authorLiana Bakradze <liana.bakradze@jetbrains.com>
Mon, 20 Jun 2016 15:27:55 +0000 (18:27 +0300)
committerLiana Bakradze <liana.bakradze@jetbrains.com>
Mon, 20 Jun 2016 15:32:04 +0000 (18:32 +0300)
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/CCVirtualFileListener.java
python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/run/PyCCCommandLineState.java
python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/run/PyCCRunTestsConfigurationProducer.java

index 36b36d02e09674a524569fadc31db11aed8e181f..eaa45861f1ca2371115a12a5c2d8603fbe57846b 100644 (file)
@@ -14,6 +14,8 @@ import com.jetbrains.edu.learning.courseFormat.Task;
 import com.jetbrains.edu.learning.courseFormat.TaskFile;
 import org.jetbrains.annotations.NotNull;
 
+import java.io.File;
+
 public class CCVirtualFileListener extends VirtualFileAdapter {
 
   @Override
@@ -33,6 +35,12 @@ public class CCVirtualFileListener extends VirtualFileAdapter {
     }
 
     String name = createdFile.getName();
+
+    CCLanguageManager manager = CCUtils.getStudyLanguageManager(course);
+    if (manager != null && manager.doNotPackFile(new File(createdFile.getPath()))) {
+      return;
+    }
+
     if (CCUtils.isTestsFile(project, createdFile)
         || StudyUtils.isTaskDescriptionFile(name)
         || name.contains(EduNames.WINDOW_POSTFIX)
index 0bde8098b28ff8d094dfc937d92cfe5029e70db0..f4678a97a665e606122b483e5e8fa720f4324d13 100644 (file)
@@ -26,6 +26,8 @@ import com.jetbrains.python.run.CommandLinePatcher;
 import com.jetbrains.python.run.PythonCommandLineState;
 import org.jetbrains.annotations.NotNull;
 
+import java.io.File;
+
 public class PyCCCommandLineState extends PythonCommandLineState {
   private final PyCCRunTestConfiguration myRunConfiguration;
   private final VirtualFile myTaskDir;
@@ -54,7 +56,7 @@ public class PyCCCommandLineState extends PythonCommandLineState {
     assert course != null;
 
     group.addParameter(myRunConfiguration.getPathToTest());
-    group.addParameter(course.getCourseDirectory());
+    group.addParameter(new File(course.getCourseDirectory()).getPath());
 
     group.addParameter(getFirstTaskFilePath());
   }
@@ -62,9 +64,10 @@ public class PyCCCommandLineState extends PythonCommandLineState {
   @NotNull
   private String getFirstTaskFilePath() {
     String firstTaskFileName = StudyUtils.getFirst(myTask.getTaskFiles().keySet());
+    String taskDirPath = FileUtil.toSystemDependentName(myTaskDir.getPath());
     return myTaskDir.findChild(EduNames.SRC) != null ?
-           FileUtil.join(myTaskDir.getPath(), EduNames.SRC, firstTaskFileName) :
-           FileUtil.join(myTaskDir.getPath(), firstTaskFileName);
+           FileUtil.join(taskDirPath, EduNames.SRC, firstTaskFileName) :
+           FileUtil.join(taskDirPath, firstTaskFileName);
   }
 
   @Override
index 53ca0c996cc2d2068c3068e7e9a7d263ba1091dd..617345600d30b183f18e9598d5b20c189a75e12d 100644 (file)
@@ -77,9 +77,10 @@ public class PyCCRunTestsConfigurationProducer extends RunConfigurationProducer<
       return null;
     }
 
+    String taskDirPath = FileUtil.toSystemDependentName(taskDir.getPath());
     String testsPath = taskDir.findChild(EduNames.SRC) != null ?
-               FileUtil.join(taskDir.getPath(), EduNames.SRC, EduNames.TESTS_FILE) :
-               FileUtil.join(taskDir.getPath(), EduNames.TESTS_FILE);
+                       FileUtil.join(taskDirPath, EduNames.SRC, EduNames.TESTS_FILE) :
+                       FileUtil.join(taskDirPath, EduNames.TESTS_FILE);
     return file.getPath().equals(testsPath) ? testsPath : null;
   }