PY-17378: django rerun tests should not depend on number of folders
authorIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Wed, 25 Nov 2015 21:16:53 +0000 (00:16 +0300)
committerIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Wed, 25 Nov 2015 21:16:53 +0000 (00:16 +0300)
Dotted.path could now be converted to virtual/file/path and back

python/src/com/jetbrains/python/psi/PyUtil.java
python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java

index 2a76d7129041848bc184b081257df9f91838bed4..bb2b0aebeadff1894f9937aea715f69ebb32e825 100644 (file)
@@ -101,6 +101,8 @@ import static com.jetbrains.python.psi.PyFunction.Modifier.STATICMETHOD;
 
 public class PyUtil {
 
+  public static final String PY_EXTENSION = ".py";
+
   private PyUtil() {
   }
 
@@ -482,7 +484,7 @@ public class PyUtil {
   }
 
   public static void deletePycFiles(String pyFilePath) {
-    if (pyFilePath.endsWith(".py")) {
+    if (pyFilePath.endsWith(PY_EXTENSION)) {
       List<File> filesToDelete = new ArrayList<File>();
       File pyc = new File(pyFilePath + "c");
       if (pyc.exists()) {
index 210200176a2f2d92fe22103eb5dc9e1463ecdc38..d77858529c03a885dc5b9248849a9db93ea720e5 100644 (file)
@@ -197,7 +197,7 @@ public class PythonUnitTestUtil {
         final VirtualFile virtualFile = containingFile.getVirtualFile();
         final String clsFileName = virtualFile == null? containingFile.getName() : virtualFile.getPath();
         final String clsFileNameWithoutExt = FileUtil.getNameWithoutExtension(clsFileName);
-        if (!clsFileNameWithoutExt.endsWith(fileName)) {
+        if (!clsFileNameWithoutExt.endsWith(fileName) && ! fileName.equals(clsFileName)) {
           continue;
         }
         if (methodName == null) {