Stepping filter: test (PY-18493)

This commit is contained in:
Elizaveta Shashkova
2016-02-17 19:27:50 +03:00
parent fd3acdc643
commit 0034352126
2 changed files with 40 additions and 0 deletions
@@ -0,0 +1,7 @@
from test_my_code import foo
a = 1
foo(a)
stopped_in_user_file = True
b = 2
@@ -17,10 +17,14 @@ import com.jetbrains.python.debugger.PyDebuggerException;
import com.jetbrains.python.debugger.PyExceptionBreakpointProperties;
import com.jetbrains.python.debugger.PyExceptionBreakpointType;
import com.jetbrains.python.debugger.pydev.PyDebugCallback;
import com.jetbrains.python.debugger.settings.PyDebuggerSettings;
import com.jetbrains.python.debugger.settings.PySteppingFilter;
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
import com.jetbrains.python.sdkTools.SdkCreationType;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -771,6 +775,35 @@ public class PythonDebuggerTest extends PyEnvTestCase {
});
}
public void testSteppingFilter() throws Exception {
runPythonTest(new PyDebuggerTask("/debug", "test_stepping_filter.py") {
@Override
public void before() throws Exception {
toggleBreakpoint(getScriptPath(), 4);
List<PySteppingFilter> filters = new ArrayList<>();
filters.add(new PySteppingFilter(true, "*/test_m?_code.py"));
final PyDebuggerSettings debuggerSettings = PyDebuggerSettings.getInstance();
debuggerSettings.setSteppingFiltersEnabled(true);
debuggerSettings.setSteppingFilters(filters);
}
@Override
public void after() throws Exception {
PyDebuggerSettings.getInstance().setSteppingFilters(Collections.emptyList());
}
@Override
public void testing() throws Exception {
waitForPause();
stepInto();
waitForPause();
stepInto();
waitForPause();
eval("stopped_in_user_file").hasValue("True");
}
});
}
//TODO: fix me as I don't work properly sometimes (something connected with process termination on agent)
//public void testResume() throws Exception {