IJPL-578 wait for indexes to be ready in tests (python)

GitOrigin-RevId: 9038f5c1b50999b8ab5c1ed8f44b2b1edca34b76
This commit is contained in:
Andrei.Kuznetsov
2024-03-04 11:32:41 +01:00
committed by intellij-monorepo-bot
parent 16030f538f
commit 946641760f
2 changed files with 4 additions and 3 deletions

View File

@@ -65,6 +65,7 @@ class PyPushingTest {
val sdk = PythonMockSdk.create(languageLevel)
WriteAction.runAndWait<RuntimeException> { ProjectJdkTable.getInstance().addJdk(sdk, disposableRule.disposable) }
module.pythonSdk = sdk
IndexingTestUtil.waitUntilIndexesAreReady(project)
val pusher = FilePropertyPusher.EP_NAME.findExtension(PythonLanguageLevelPusher::class.java)
Assertions.assertThat(pusher).withFailMessage("Failed to find pusher").isNotNull

View File

@@ -22,7 +22,6 @@ import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.impl.FilePropertyPusher;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VfsUtil;
@@ -40,9 +39,7 @@ import com.intellij.usageView.UsageInfo;
import com.intellij.usages.Usage;
import com.intellij.usages.rules.PsiElementUsage;
import com.intellij.util.CommonProcessors.CollectProcessor;
import com.intellij.util.ContentsUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.PythonLanguage;
import com.jetbrains.python.PythonTestUtil;
@@ -226,6 +223,7 @@ public abstract class PyTestCase extends UsefulTestCase {
modificator.addRoot(root, rootType);
modificator.commitChanges();
});
IndexingTestUtil.waitUntilIndexesAreReadyInAllOpenedProjects();
try {
rootConsumer.accept(root);
}
@@ -236,6 +234,7 @@ public abstract class PyTestCase extends UsefulTestCase {
modificator.removeRoot(root, rootType);
modificator.commitChanges();
});
IndexingTestUtil.waitUntilIndexesAreReadyInAllOpenedProjects();
}
}
@@ -283,6 +282,7 @@ public abstract class PyTestCase extends UsefulTestCase {
private void setLanguageLevel(@Nullable LanguageLevel languageLevel) {
PythonLanguageLevelPusher.setForcedLanguageLevel(myFixture.getProject(), languageLevel);
IndexingTestUtil.waitUntilIndexesAreReady(myFixture.getProject());
}
protected void runWithLanguageLevel(@NotNull LanguageLevel languageLevel, @NotNull Runnable runnable) {