json: fix tests on agents

GitOrigin-RevId: a613e720caaf761505ed1b91223bff47fb4430b7
This commit is contained in:
Anton Lobov
2019-09-12 12:01:13 +00:00
committed by intellij-monorepo-bot
parent 96a550bb3e
commit 3b608e17af
@@ -5,8 +5,10 @@ import com.intellij.json.formatter.JsonCodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.TestDataPath;
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
import com.intellij.testFramework.fixtures.IdeaTestExecutionPolicy;
import org.jetbrains.annotations.NotNull;
/**
@@ -40,6 +42,11 @@ public abstract class JsonTestCase extends BasePlatformTestCase {
@Override
@NotNull
public String getBasePath() {
return "/community/json/tests/testData";
String communityPath = PlatformTestUtil.getCommunityPath();
String homePath = IdeaTestExecutionPolicy.getHomePathWithPolicy();
if (communityPath.startsWith(homePath)) {
return communityPath.substring(homePath.length()) + "/json/tests/testData";
}
return "/json/tests/testData";
}
}