Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vladimir.Orlov
2016-07-01 15:11:07 +03:00
5 changed files with 41 additions and 25 deletions
@@ -16,6 +16,7 @@
package com.intellij.testIntegration;
import com.intellij.execution.TestStateStorage;
import com.intellij.internal.statistic.UsageTrigger;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.ApplicationManager;
@@ -30,7 +31,8 @@ import java.util.Map;
public class ShowRecentTests extends AnAction {
private static final int TEST_LIMIT = Integer.MAX_VALUE;
private static final String ID = "show.recent.tests.action";
private static Date getSinceDate() {
return new Date(System.currentTimeMillis() - Time.DAY);
}
@@ -45,6 +47,8 @@ public class ShowRecentTests extends AnAction {
final Project project = e.getProject();
if (project == null) return;
UsageTrigger.trigger(ID);
final TestStateStorage testStorage = TestStateStorage.getInstance(project);
final TestLocator testLocator = new TestLocator(project);
final RecentTestRunnerImpl testRunner = new RecentTestRunnerImpl(project, testLocator);
@@ -138,11 +138,13 @@ public class MacOSApplicationProvider implements ApplicationComponent {
if (list.isEmpty()) return;
File file = list.get(0);
submit(() -> {
LOG.debug("MacMenu: try to open file");
if (ProjectUtil.openOrImport(file.getAbsolutePath(), project, true) != null) {
LOG.debug("MacMenu: load project for ", file);
IdeaApplication.getInstance().setPerformProjectLoad(false);
return;
}
LOG.debug("MacMenu: project = ", project);
if (project != null && file.exists()) {
LOG.debug("MacMenu: open file ", file);
OpenFileAction.openFile(file.getAbsolutePath(), project);
@@ -189,7 +191,7 @@ public class MacOSApplicationProvider implements ApplicationComponent {
}
private static void submit(@NotNull Runnable task) {
LOG.debug("MacMenu: on EDT = ", SwingUtilities.isEventDispatchThread());
LOG.debug("MacMenu: on EDT = ", SwingUtilities.isEventDispatchThread(), "; ENABLED = ", ENABLED.get());
if (!ENABLED.get()) return;
Component component = IdeFocusManager.getGlobalInstance().getFocusOwner();
@@ -169,17 +169,18 @@ def create_signature_message(signature):
def send_signature_call_trace(dbg, frame, filename):
if dbg.signature_factory and dbg.signature_factory.is_in_scope(filename):
signature = dbg.signature_factory.create_signature(frame)
if dbg.signature_factory.cache is not None:
if not dbg.signature_factory.cache.is_in_cache(signature):
dbg.signature_factory.cache.add(signature)
if signature is not None:
if dbg.signature_factory.cache is not None:
if not dbg.signature_factory.cache.is_in_cache(signature):
dbg.signature_factory.cache.add(signature)
dbg.writer.add_command(create_signature_message(signature))
return True
else:
# we don't send signature if it is cached
return False
else:
dbg.writer.add_command(create_signature_message(signature))
return True
else:
# we don't send signature if it is cached
return False
else:
dbg.writer.add_command(create_signature_message(signature))
return True
return False
@@ -157,20 +157,21 @@ def get_clsname_for_code(code, frame):
func_name = code.co_name
if len(code.co_varnames) > 0:
first_arg_name = code.co_varnames[0]
first_arg_obj = frame.f_locals[first_arg_name]
if inspect.isclass(first_arg_obj): # class method
first_arg_class = first_arg_obj
else: # instance method
first_arg_class = first_arg_obj.__class__
if hasattr(first_arg_class, func_name):
method = getattr(first_arg_class, func_name)
func_code = None
if hasattr(method, 'func_code'): # Python2
func_code = method.func_code
elif hasattr(method, '__code__'): # Python3
func_code = method.__code__
if func_code and func_code == code:
clsname = first_arg_class.__name__
if first_arg_name in frame.f_locals:
first_arg_obj = frame.f_locals[first_arg_name]
if inspect.isclass(first_arg_obj): # class method
first_arg_class = first_arg_obj
else: # instance method
first_arg_class = first_arg_obj.__class__
if hasattr(first_arg_class, func_name):
method = getattr(first_arg_class, func_name)
func_code = None
if hasattr(method, 'func_code'): # Python2
func_code = method.func_code
elif hasattr(method, '__code__'): # Python3
func_code = method.__code__
if func_code and func_code == code:
clsname = first_arg_class.__name__
return clsname
@@ -26,9 +26,11 @@ import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.testframework.AbstractTestProxy;
import com.intellij.execution.testframework.TestFrameworkRunningModel;
import com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentContainer;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.search.GlobalSearchScope;
import com.jetbrains.python.HelperPackage;
@@ -39,6 +41,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.stream.Collectors;
public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
protected PyRerunFailedTestsAction(@NotNull ComponentContainer componentContainer) {
@@ -132,6 +135,11 @@ public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
}
}
}
if (specs.isEmpty()) {
final List<String> locations = failedTests.stream().map(AbstractTestProxy::getLocationUrl).collect(Collectors.toList());
Logger.getInstance(FailedPythonTestCommandLineStateBase.class).warn(
String.format("Can't resolve specs for the following tests: %s", StringUtil.join(locations, ", ")));
}
return specs;
}