PY-12564 Django: Template directories auto-configuration is missing on opening existi...
authorIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Thu, 27 Nov 2014 15:10:11 +0000 (18:10 +0300)
committerIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Thu, 27 Nov 2014 15:10:11 +0000 (18:10 +0300)
PY-12876 Jinja2 Unresolved template reference

python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java

index dbaf8b67059a7dc424b864577edd3814e3bc00df..af93b8178dca695674c1efaed8f0d26dbf71c90c 100644 (file)
@@ -17,7 +17,6 @@ package com.jetbrains.python.fixtures;
 
 import com.google.common.base.Joiner;
 import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.codeInsight.lookup.LookupElement;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.codeInspection.ex.QuickFixWrapper;
 import com.intellij.execution.actions.ConfigurationContext;
@@ -42,8 +41,10 @@ import com.intellij.openapi.roots.ModifiableRootModel;
 import com.intellij.openapi.roots.OrderRootType;
 import com.intellij.openapi.roots.impl.FilePropertyPusher;
 import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.platform.DirectoryProjectConfigurator;
 import com.intellij.psi.*;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.refactoring.RefactoringActionHandler;
@@ -303,6 +304,20 @@ public abstract class PyTestCase extends UsefulTestCase {
     handler.invoke(myFixture.getProject(), editor, myFixture.getFile(), ((EditorEx)editor).getDataContext());
   }
 
+  /**
+   * Configures project by some path. It is here to emulate {@link com.intellij.platform.PlatformProjectOpenProcessor}
+   *
+   * @param path         path to open
+   * @param configurator configurator to use
+   */
+  protected void configureProjectByProjectConfigurators(@NotNull final String path,
+                                                        @NotNull final DirectoryProjectConfigurator configurator) {
+    final VirtualFile newPath =
+      myFixture.copyDirectoryToProject(path, String.format("%s%s%s", "temp_for_project_conf", File.pathSeparator, path));
+    final Ref<Module> moduleRef = new Ref<Module>(myFixture.getModule());
+    configurator.configureProject(myFixture.getProject(), newPath, moduleRef);
+  }
+
   protected static class PyLightProjectDescriptor implements LightProjectDescriptor {
     private final String myPythonVersion;