List<String> passedRoots = Lists.newArrayList();
+ final Set<String> requiredTags = Sets.union(testTask.getTags(), Sets.newHashSet(tagsRequiedByTest));
+
+ final Set<String> tagsToCover = testTask.getTagsToCover();
+
for (String root : myRoots) {
- LOG.warn(String.format("Running on root %s", root));
- final Set<String> requredTags = Sets.union(testTask.getTags(), Sets.newHashSet(tagsRequiedByTest));
- final boolean suitableForTask = isSuitableForTask(PyEnvTestCase.loadEnvTags(root), requredTags);
+ List<String> envTags = PyEnvTestCase.loadEnvTags(root);
+ final boolean suitableForTask = isSuitableForTask(envTags, requiredTags);
final boolean shouldRun = shouldRun(root, testTask);
if (!suitableForTask || !shouldRun) {
LOG.warn(String.format("Skipping %s (compatible with tags: %s, should run:%s)", root, suitableForTask, shouldRun));
continue;
}
+ if (tagsToCover != null && envTags.size() > 0 && !isNeededToRun(tagsToCover, envTags)) {
+ LOG.warn(String.format("Skipping %s (test already was executed on a similar environment)", root));
+ continue;
+ }
+
+ if (tagsToCover != null) {
+ tagsToCover.removeAll(envTags);
+ }
+
+ LOG.warn(String.format("Running on root %s", root));
+
try {
testTask.setUp(testName);
wasExecuted = true;
}
}
+ private static boolean isNeededToRun(@NotNull Set<String> tagsToCover, @NotNull List<String> envTags) {
+ for (String tag : envTags) {
+ if (tagsToCover.contains(tag)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/**
* Create SDK by path to python exectuable
*
return necessaryTags.isEmpty();
}
-
public static boolean isJython(@NotNull String sdkHome) {
return sdkHome.toLowerCase().contains("jython");
}
package com.jetbrains.env;
import com.google.common.collect.Sets;
-import com.intellij.openapi.util.io.FileUtil;
import com.jetbrains.python.psi.LanguageLevel;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Set;
public boolean isLanguageLevelSupported(@NotNull final LanguageLevel level) {
return true;
}
+
+ /**
+ * Provides a way to filter out non-relevant environments
+ *
+ * @return the set of a tags that interpreter should run on, if an environment doesn't contain one of them, it won't be
+ * used to run this test task.
+ * null in case filtering shouldn't be used
+ */
+ @Nullable
+ public Set<String> getTagsToCover() {
+ return null;
+ }
}
*/
package com.jetbrains.env.python.debug;
+import com.google.common.collect.Sets;
import com.intellij.execution.*;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.RunProfile;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.ServerSocket;
+import java.util.Set;
import java.util.concurrent.Semaphore;
/**
}
+ @Nullable
+ @Override
+ public Set<String> getTagsToCover() {
+ return Sets.newHashSet("python2.6", "python2.7", "python3.5", "python3.6", "jython", "IronPython", "pypy");
+ }
+
public void runTestOn(String sdkHome) throws Exception {
final Project project = getProject();