PY-33328 Don't show false settrace warning for Python 2

GitOrigin-RevId: b7ef9da41da2e70e19e2b8ba07d32fd7d7663025
This commit is contained in:
Andrey Lisin
2019-07-04 15:03:18 +03:00
committed by intellij-monorepo-bot
parent c0593b39c1
commit ae87e93cf9
3 changed files with 23 additions and 2 deletions
+2 -2
View File
@@ -50,8 +50,8 @@ def _internal_set_trace(tracing_func):
if TracingFunctionHolder._warn:
frame = get_frame()
if frame is not None and frame.f_back is not None:
if not frame.f_back.f_code.co_filename.lower().endswith('threading.py'):
filename = frame.f_back.f_code.co_filename.lower()
if not filename.endswith('threading.py') and not filename.endswith('pydevd_tracing.py'):
message = \
'\nPYDEV DEBUGGER WARNING:' + \
'\nsys.settrace() should not be used when the debugger is being used.' + \
@@ -0,0 +1,3 @@
import sys
sys.settrace(None)
@@ -2186,4 +2186,22 @@ public class PythonDebuggerTest extends PyEnvTestCase {
}
});
}
@Test
public void testCallingSettraceWarning() {
runPythonTest(new PyDebuggerTask("/debug", "test_calling_settrace_warning.py") {
@Override
public void before() {
toggleBreakpoint(getFilePath(getScriptName()), 2);
}
@Override
public void testing() throws Exception {
waitForPause();
resume();
waitForTerminate();
outputContains("PYDEV DEBUGGER WARNING:\nsys.settrace() should not be used when the debugger is being used.");
}
});
}
}